News for hackers. Stuff that matters.
Re:Go with PHP by tored on Friday May 12, 2023 @12:55PM (#35918835)
This is one of the reasons I like PHP, in newer PHP versions it is an attribute but in older versions it is just a comment. Clever and backwards compatible.
Re:Go with PHP by Nullabillity on Friday May 12, 2023 @01:17PM (#35919079)
It isn't backwards compatible (`#[foo` used to be legal PHP 7, but is illegal in PHP 8).

It may technically be forwards compatible syntactically (`#[foo]` will, as you say, just be ignored by PHP 7), but that's an anti-feature (assuming that the attribute isn't a no-op, it'll presumably break something else).

Re:Go with PHP by tored on Friday May 12, 2023 @01:21PM (#35919144)
Okay, forward compatible. It makes it easier for framework and library maintainers to support multiple versions of PHP, which is nice.

> `#[foo` used to be legal PHP 7, but is illegal in PHP 8).

So it is not a comment in PHP8 then.