php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #34532 It would be nice if empty() could accept multiple arguments just like isset()
Submitted: 2005-09-16 20:35 UTC Modified: 2005-09-16 22:26 UTC
Votes:3
Avg. Score:5.0 ± 0.0
Reproduced:3 of 3 (100.0%)
Same Version:1 (33.3%)
Same OS:2 (66.7%)
From: phpbugs at majiclab dot com Assigned:
Status: Wont fix Package: Feature/Change Request
PHP Version: 5.0.5 OS: N/A
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: phpbugs at majiclab dot com
New email:
PHP Version: OS:

 

 [2005-09-16 20:35 UTC] phpbugs at majiclab dot com
Description:
------------
It would be nice if empty() would accept multiple arguments 
like isset() does.  It would be functionally equivalent to:

empty(var) || empty(var2) ... || empty(varN)

Reproduce code:
---------------
<?php
$a = 1;
if (empty($a, $b, $c)) {
    echo 'Either $a, $b or $c was empty/did not exist.';
}
?>

Expected result:
----------------
Either $a, $b or $c was empty/did not exist.

Actual result:
--------------
parse error, unexpected ',', expecting ')' in /.../file.php on 
line 3

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-09-16 22:26 UTC] derick@php.net
We discussed this a year ago, and came to the conclusion that we could not agree on semantics. This is why we will not be adding this feature to PHP.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Jul 12 05:01:33 2025 UTC