3v4l.org

run code in 300+ PHP versions simultaneously
<?php class F { public int $bar = null; function foo ($bar = null) { $this->bar = $bar; } } $f = new F(); var_dump($f->bar); var_dump($f->foo());
Output for 5.5.0 - 5.5.34, 5.6.0 - 5.6.20, 7.0.0 - 7.0.5
Parse error: syntax error, unexpected 'int' (T_STRING), expecting variable (T_VARIABLE) in /in/3tUu9 on line 4
Process exited with code 255.

preferences:
159.22 ms | 1443 KiB | 7 Q