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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Wed Jul 03 09:01:29 2024 UTC