Req #77469 [Sus]: Support for multiple empty() arguments - like isset()
| From: | nikic@php.net | Date: | Fri, 18 Jan 2019 11:23:38 +0000 |
| Subject: | Req #77469 [Sus]: Support for multiple empty() arguments - like isset() | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-219053@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=77469&edit=1
ID: 77469
Updated by: nikic@php.net
Reported by: rich at milns dot com
Summary: Support for multiple empty() arguments - like
isset()
Status: Suspended
Type: Feature/Change Request
Package: Variables related
Operating System: All
PHP Version: 7.2.14
Block user comment: N
Private report: N
New Comment:
Ooops, I mixed up the logic ops. I meant that empty($a, $b) desugars to empty($a) || empty($b) and
isset($a, $b) desugars to isset($a) && isset($b).
Previous Comments:
------------------------------------------------------------------------
[2019-01-18 11:22:19] nikic@php.net
There has been an RFC for this feature, which was declined: https://wiki.php.net/rfc/variadic_empty
The reason why this RFC failed is basically that empty($a, $b) must desugar to empty($a) &&
empty($b), while isset($a, $b) desugars to isset($a) || isset($b). Some people felt that this is
confusing.
I'm suspending this ticket, as a new RFC proposal would be necessary to accept this feature.
------------------------------------------------------------------------
[2019-01-16 14:37:11] 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
?>
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=77469&edit=1