3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function id($x) { return $x; } echo (new class { public function nameThyself() { return get_class($this); } })->nameThyself();
based on dQZGs
Output for 7.2.0
class@anonymous/in/5YfRO0x7f36b5e05092
Output for 7.1.10
class@anonymous/in/5YfRO0x7ff4bb90d092
Output for 7.1.7
class@anonymous/in/5YfRO0x7f776d045092
Output for 7.1.6
class@anonymous/in/5YfRO0x7fa1ff438092
Output for 7.1.5
class@anonymous/in/5YfRO0x7fcf1799b092
Output for 7.1.0
class@anonymous/in/5YfRO0x7f068547f092
Output for 7.0.20
class@anonymous/in/5YfRO0x7f92d76f4092
Output for 7.0.6
class@anonymous/in/5YfRO0x7f677d91e092
Output for 7.0.5
class@anonymous/in/5YfRO0x7f00f40a8092
Output for 7.0.4
class@anonymous/in/5YfRO0x7f37983b8092
Output for 7.0.3
class@anonymous/in/5YfRO0x7fc088ef0092
Output for 7.0.2
class@anonymous/in/5YfRO0x7fbaae0c3092
Output for 7.0.1
class@anonymous/in/5YfRO0x7fdcadf7d092
Output for 7.0.0
class@anonymous/in/5YfRO0x7f165b250092
Output for 5.4.2 - 5.6.28
Parse error: syntax error, unexpected 'class' (T_CLASS) in /in/5YfRO on line 7
Process exited with code 255.
Output for 5.3.18 - 5.3.29
Parse error: syntax error, unexpected T_CLASS in /in/5YfRO on line 7
Process exited with code 255.