3v4l.org

run code in 500+ PHP versions simultaneously
<?php class Point { public function __construct( public float $x, public float $y = 0.0, public float $z = 0.0, ) {} } foreach ((new ReflectionClass(Point::class))->getProperties() as $property) { var_dump($property->name); }
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.34, 8.2.0 - 8.2.36, 8.3.0 - 8.3.37, 8.4.1 - 8.4.28, 8.5.0 - 8.5.13, 8.6.0
string(1) "x" string(1) "y" string(1) "z"
Output for 7.3.0 - 7.3.33, 7.4.0 - 7.4.13
Parse error: syntax error, unexpected 'public' (T_PUBLIC), expecting variable (T_VARIABLE) in /in/JsbXT on line 5
Process exited with code 255.

preferences:
28.2 ms | 1167 KiB | 6 Q