|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #72266 AND and OR combined operators
Submitted: 2016-05-26 11:15 UTC Modified: -
Avg. Score:3.0 ± 0.0
Reproduced:1 of 2 (50.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: remyfox at hotmail dot com Assigned:
Status: Open Package: Variables related
PHP Version: Irrelevant OS: Any
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2016-05-26 11:15 UTC] remyfox at hotmail dot com
From the manual there are "combined operators" for all of the binary arithmetic, array union and string operators that allow you to use a value in an expression and then set its value to the result of that expression.

Wouldn't it be better to allow combined operations for all binary operators? It seems arbitrary that some binary operators (such as the logical ones) don't  support this. There seem to be plenty of use cases.

Test script:
// In a system where a user obtains a permission if he has at least one role that gives such a permission.

$permitted = false;

foreach ($user_roles as $user_role) {
	$permitted ||= $user_role["permitted"];

// In a system where multiple validations exists which each return a boolean.
$valid = true;

foreach ($validations as $validation) {
	$valid &&= $validation();


Add a Patch

Pull Requests

Pull requests:

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2019-08-14 12:55 UTC] tolsen at southern dot edu
The following pull request has been associated:

Patch Name: Added request #72266
On GitHub:
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Mon Aug 02 20:01:24 2021 UTC