Where Is The Semicolon?¶
<?php
#[A (new B(4), 2, 3)]
// Parse error: syntax error, unexpected token ";" in /in/vNMQk on line 5
?>
This code is an attribute. A attribute always expects to be followed by a structure that it will characterize. Here, without anything else to parse, the parser displays a mysterious error about a semi colon, while none is in sight.
In fact, the closing PHP tag has a built-in semi colon, to end any expression that was still open.
This is similar to another tip, that relies on echo.
See Also¶
Unexpected token ; [Try me]
PHP Error Messages¶
PHP Features¶
Last updated: 14 July 2026