3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Demo { public function __construct( final public string $v ) {} } $d = new Demo( "FOO" ); var_dump( $d ); $r = new ReflectionProperty( Demo::class, 'v' ); var_dump( $r->isFinal() );
Output for 8.3.0 - 8.3.17, 8.4.1 - 8.4.4
Fatal error: Cannot use the final modifier on a parameter in /in/t2Pra on line 5
Process exited with code 255.
Output for 8.2.0 - 8.2.27
Parse error: syntax error, unexpected token "final", expecting variable in /in/t2Pra on line 5
Process exited with code 255.

preferences:
153.36 ms | 1001 KiB | 7 Q