|  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:0 of 1 (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
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.
Block user comment
Status: Assign to:
Bug Type:
From: remyfox at hotmail dot com
New email:
PHP Version: OS:


 [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-2020 The PHP Group
All rights reserved.
Last updated: Sat Aug 15 18:01:26 2020 UTC