On 21 February 2015 at 07:20, Markus Fischer <mar...@fischer.name> wrote: > On 21.02.15 06:11, Thomas Punt wrote: > From the RFC: >> Also, it will make empty() more inline with the not-too-disimillar isset(), > > Here I disagree. > > I would have assumed from the start that empty() would only return true > if *all* of the entries are empty, i.e. AND things together.
The problem stems from the fact that 'empty' is a falsy statement as it returns true when something is not set. Combining two positive results in another positive statement. Combining two negative statements results in a positive statement.....except when it doesn't. You always have to think about what is the correct way to combine them. >From the RFC: > In PHP, it is not uncommon to see conditionals consisting of multiple empty() > invocations. This is evident by simply browsing through some popular open > source projects This is subjective opinion, but at least two of those code examples are horrible. In particular the phpBB code shows the problem of using compound 'falsy' statements: return !( empty($this->config['jab_enable']) || empty($this->config['jab_host']) || empty($this->config['jab_username']) || empty($this->config['jab_password']) || !@extension_loaded('xml') ); Seriously, a double-negative at the end of a five piece statement that combines falsy things? Making it easier to write bad (imo) code does not seem a good reason for a change. cheers Dan -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php