Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Array Syntax With Curly Braces Are No More

Using the array syntax with curly braces used to yield a Fatal error, and a nice error message.

After PHP 8.4, it is downgraded to a simple 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

Fatal error: Array and string offset access syntax with curly braces is no longer supported

After

PHP Parse error:  syntax error, unexpected token "\{" 

Parse error: syntax error, unexpected token "\{" 

PHP version change

This behavior changed in 8.4.

Error Messages

© 2023-2026, Damien Seguy - Exakat