On Thu, April 12, 2012 6:05 pm, Johannes Schlüter wrote:
> 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 :-)

If one doesn't know isset/empty aren't functions, one doesn't
understand their purpose nor how variables are used/scoped.

If one doesn't know these things, one should learn. Quickly.

Call to undefined function is exactly correct.

$a = 5;
$b = 3;
$foo = 'if';
$foo ($a == $b){
  echo "Nope.";
}

While it might be as nifty as runkit to do this, it should not be
encouraged. Or even allowed.

-- 
brain cancer update:
http://richardlynch.blogspot.com/search/label/brain%20tumor
Donate:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=FS9NLTNEEKWBE



-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to