3v4l.org

run code in 500+ PHP versions simultaneously
<?php #[Attribute(Attribute::TARGET_PROPERTY)] class AT { public function __construct($mixed){} } class dto { #[AT([ new AT() ])] private $p; }
Output for 8.1.0 - 8.1.34, 8.2.25 - 8.2.30, 8.3.5 - 8.3.31, 8.4.1 - 8.4.22, 8.5.0 - 8.5.7
Output for 8.0.1 - 8.0.21
Fatal error: Constant expression contains invalid operations in /in/Dj0lN on line 15
Process exited with code 255.
Output for 7.4.0 - 7.4.30
Parse error: syntax error, unexpected 'new' (T_NEW), expecting function (T_FUNCTION) or const (T_CONST) in /in/Dj0lN on line 13
Process exited with code 255.

preferences:
64.87 ms | 959 KiB | 4 Q