3 ms·
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
by Nullabillity 3y ago
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).
- tored 3y agoOkay, 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.