Copied from wiki.php.net, last synchronized Oct 13, 2026 11:53 UTC
Arrays in PHP have long since supported trailing commas.
$foo = [
'foo',
'bar',
];
This makes for clean diffs and easy appending of new values in user-land.
Unfortunately, the argument list for function/method declarations and calls do not share the same luxury.
// Parse error
function myFunc(
$foo,
$bar,
) {
/* ... */
}
// Parse error
myFunc(
$foo,
$bar,
);
This RFC proposes allowing function/method declarations and calls to allow for trailing commas in order to:
This change would have no breaking changes.
PHP 7.1
Project requires a 2/3 majority.