> On 13 Feb 2015, at 11:16, Andrea Faulds <a...@ajf.me> wrote:
> 
> Hey,
> 
>> On 13 Feb 2015, at 07:28, Michael Wallner <m...@php.net> wrote:
>> 
>> On 12/02/15 19:55, Thomas Punt wrote:
>> 
>>> I'd like to propose to make empty() a variadic, where if any
>>> arguments passed in are considered empty, then false is returned
>> 
>> Should that read "if any arguments passed in are considered *NOT* empty,
>> then false is returned”?
> 
> No, I think it’s correct, if confusingly phrased. I believe Thomas is 
> proposing variadic empty() where TRUE is returned if any of its arguments are 
> empty, otherwise FALSE. So, empty($a, $b, $c) would be equivalent to 
> empty($a) || empty($b) || empty($c), much like isset($a, $b, $c) is 
> equivalent to (and implemented as) isset($a) && isset($b) && isset($c).

Wait, I think I made a mistake.

* Thomas proposed "if any arguments passed in are considered empty, then false 
is returned”, i.e. !(empty($a) || empty($b) || empty($c)) if his words are 
taken literally. This doesn’t make much sense, I think it was a mistake.
* You suggested he may have meant "if any arguments passed in are considered 
*NOT* empty, then false is returned”, i.e. (empty($a) && empty($b) && empty($c))
* I assume Thomas actually meant “where if any arguments passed in are 
considered empty, then *true* is returned”, i.e. (empty($a) || empty($b) || 
empty($c))

Sorry for the confusion.

I think the || behaviour is the most useful, as it’s the analogue of isset’s. 
So !empty($a, $b, $c) would work similarly to isset($a, $b, $c), and similarly, 
!isset($a, $b, $c) would work similarly to empty($a, $b, $c).

But that’s just my opinion. :)
--
Andrea Faulds
http://ajf.me/





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

Reply via email to