3v4l.org

run code in 300+ PHP versions simultaneously
<?php $foo = []; $obj = new class { public function __construct() { var_dump($foo); } }
Output for 7.1.0 - 7.1.23, 7.2.0 - 7.2.11
Parse error: syntax error, unexpected end of file in /in/RUJDN on line 7
Process exited with code 255.
Output for 5.6.38
Parse error: syntax error, unexpected 'class' (T_CLASS) in /in/RUJDN on line 5
Process exited with code 255.

preferences:
173.62 ms | 1394 KiB | 44 Q