Array Syntax With Curly Braces Are No More¶
Until PHP 8.4, using the array syntax with curly braces yielded a Fatal error, and a nice error message.
After that, it is downgraded to a syntax error.
PHP code¶
<?php
$x{3} = 2;
print_r($x);
?>
Before¶
PHP Fatal error: Array and string offset access syntax with curly braces is no longer supported in /codes/curly_braces.php on line 3
Fatal error: Array and string offset access syntax with curly braces is no longer supported in /codes/curly_braces.php on line 3
After¶
PHP Parse error: syntax error, unexpected token { in /codes/curly_braces.php on line 3
Parse error: syntax error, unexpected token { in /codes/curly_braces.php on line 3
PHP version change¶
This behavior changed in 8.4