> Hi!
>
> "The original reason for this restriction probably is that - in a way -
> it "doesn't make sense" to pass anything but a variable to empty()"
>
> I don't see the point of empty( function() ).
>
> You tipically use empty on values that holds information you want to use
> later in the program flow (a string, an integer). That means you'd better
> extract it to a variable because you want to avoid calling twice a function
> that provides this value.
>
> In my opinion, in other cases a 'isThatStuffTrueOrFalse()' function should
> be created to provide the same information as empty( returnThatStuff() ).
> They both are yes-no questions, but the preceding one is a better
> indication what the program does.
>
> Pal
>
>
> 2012/4/13 Johannes Schlüter <johan...@schlueters.de>
>
>> 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
>>
>>
>> --
>> PHP Internals - PHP Runtime Development Mailing List
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>

Reply via email to