3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $instance = new class {}; $c = get_class($instance); $buf = substr($c, -14); $class_name = "class@anonymous".chr(0).__FILE__.$buf; eval("$x = new $class_name {};"); var_dump($x);
based on RjhZd
Output for 7.0.0 - 7.2.0
Notice: Undefined variable: x in /in/cInXT on line 9 Parse error: syntax error, unexpected '=', expecting end of file in /in/cInXT(9) : eval()'d code on line 1
Process exited with code 255.
Output for 5.4.9 - 5.6.28
Parse error: syntax error, unexpected 'class' (T_CLASS) in /in/cInXT on line 3
Process exited with code 255.
Output for 5.3.19 - 5.3.29
Parse error: syntax error, unexpected T_CLASS in /in/cInXT on line 3
Process exited with code 255.