Re: Allow non-variable arguments to empty()
| From: | Johannes Schlüter | Date: | Thu, 12 Apr 2012 23:05:31 +0000 |
| Subject: | Re: Allow non-variable arguments to empty() | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-59808@lists.php.net to get a copy of this message | ||
On Wed, 2012-04-11 at 00:53 +0200, Nikita Popov wrote:
>
> Currently the empty() language construct only works on variables. You
> can write if (empty($array)) but not empty if (empty(getSomeArray()).
I've mentioned this thought off-list already but let's discuss it
officially:
A fear I have is that this makes empty more looking like a function,
while not being one. Right now one notices quite quickly that it is
something else. Things like $check = $condition ? "empty" : "isset";
$check($bar); trigger an even more confusing error (Call to undefined
function)
I'm not sure whether that's a strong argument, but I guess it's good
enough to be noted :-)
johannes