|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2019-01-16 14:37 UTC] rich at milns dot com
Description: ------------ It would be useful if the empty() function also supported multiple function arguments, like isset() does. So basically "are all of these variables empty()". Similar to: Bug #12978: Multiple isset Test script: --------------- e.g. <?php // multiple variables supported by empty() var_dump(empty($var1, $var2, $var3)); // true ?> instead of: <?php // repeatedly calling empty() to check multiple variables $result = (empty($var1) and empty($var2) and empty($var3)); var_dump($result); // true ?> PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 15 09:00:01 2025 UTC |
> I agree that the RFC you linked to was incorrect, but do you think a new RFC along these lines would be acceptable? The semantics in the RFC are correct. The easiest way to understand why it must work this way is to consider that isset($a, $b) should be basically the same as !empty($a, $b) (modulo the distinction of null vs falsy values). isset($a, $b) ==> isset($a) && isset($b) !empty($a, $b) ==> !empty($a) && !empty($b) By de Morgans law, this means that empty($a, $b) is empty($a) || empty($b). An RFC that does not follow these semantics would not be accepted.