PHP already lets you leave a trailing comma in arrays, function calls and parameter lists. This RFC from Len Woodward applies the same idea to boolean operators, so a condition inside parentheses could end with a spare &&, ||, and or or that PHP ignores.
// Currently invalid, proposed to be valid: if ( $user->isActive() && $user->hasPermission('edit') && $resource->isEditable() && ) { // ... }
Why you'd want it
The reasons match the ones behind trailing commas:
- Cleaner diffs. Adding a condition changes one line instead of two.
- Easier reordering. You can move lines around without fixing the operators.
- Fewer syntax errors. If you delete the last condition, you don't have to remember to remove the operator on the line above.
Here's what adding a condition looks like today:
if (
$user->isActive() &&
- $user->hasPermission('edit')
+ $user->hasPermission('edit') &&
+ $resource->isEditable()
) {
And here's the same change with a trailing operator:
if (
$user->isActive() &&
$user->hasPermission('edit') &&
+ $resource->isEditable() &&
) {
PSR-12 already allows operators at the end of a line. The RFC points out that putting them at the start of each line only moves the problem from the last line to the first.
Where it's allowed
You can use a trailing operator in:
- Parenthesized expressions, like
($a && $b &&) - The conditions of
if,elseif,while,do-whileandswitch matchexpressions
A bare expression like $x = $a &&;, a return statement or an array stays a syntax error. xor and the bitwise | and & operators aren't covered.
What it means for existing code
Nothing breaks. Code that used to be a syntax error becomes valid, and nothing that works today changes behavior. It's a parser-only change, so the compiled opcodes are identical with or without the extra operator. IDEs, static analyzers and formatters will need updates, and until then they'll flag the new syntax as an error.
Where it stands
The RFC is under discussion. It was first posted in February 2026 and targets PHP 8.6, with a planned vote that needs a two-thirds majority. No implementation has been posted yet.