#49718 [NEW]: Logical Combination Assignment Operators
| From: | robeddielee at hotmail dot com | Date: | Tue, 29 Sep 2009 23:56:29 +0000 |
| Subject: | #49718 [NEW]: Logical Combination Assignment Operators | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-143066@lists.php.net to get a copy of this message | ||
From: robeddielee at hotmail dot com
Operating system: Irrelevant
PHP version: 5.3.0
PHP Bug Type: Feature/Change Request
Bug description: Logical Combination Assignment Operators
Description:
------------
PHP current supports combination assignment operators for arithmetic,
bitwise, and string operations. These operators include: +=, *=, %=, &=,
etc...
PHP should also support combination assignment operators for logical
operations such as && and ||.
The requested operators are: &&=, and ||=. I would also request XOR, but
there doesn't appear to be a ^^ operator to begin with that isn't spelled
out.
NOTE: This is NOT the same request as Bug #12930.
Reproduce code:
---------------
$valid = true;
$valid &&= isCondition1();
$valid &&= isCondition2();
$valid &&= isCondition3();
var_export($valid);
Expected result:
----------------
$valid should be set to boolean true, only if the three conditions
evaluate to true. If any condition evaluates to false, $valid should be set
to false.
Actual result:
--------------
PHP Parse error: syntax error, unexpected '='...
--
Edit bug report at http://bugs.php.net/?id=49718&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=49718&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=49718&r=trysnapshot53
Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=49718&r=trysnapshot60
Fixed in SVN: http://bugs.php.net/fix.php?id=49718&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=49718&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=49718&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=49718&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=49718&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=49718&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=49718&r=support
Expected behavior: http://bugs.php.net/fix.php?id=49718&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=49718&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=49718&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=49718&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=49718&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=49718&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=49718&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=49718&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=49718&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=49718&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=49718&r=mysqlcfg