3v4l.org

run code in 500+ PHP versions simultaneously
<?php class Foo { public function __construct( public string $a, public string $b, private string $c, ) { } } var_dump(new Foo('a', 'b', 'c'));
Output for 8.0.1 - 8.0.30, 8.1.0 - 8.1.34, 8.2.0 - 8.2.30, 8.3.0 - 8.3.30, 8.4.1 - 8.4.22, 8.5.0 - 8.5.7
object(Foo)#1 (3) { ["a"]=> string(1) "a" ["b"]=> string(1) "b" ["c":"Foo":private]=> string(1) "c" }
Output for 7.4.0 - 7.4.33
Parse error: syntax error, unexpected 'public' (T_PUBLIC), expecting variable (T_VARIABLE) in /in/2hirZ on line 6
Process exited with code 255.

preferences:
40.51 ms | 1276 KiB | 4 Q