3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function demo(callable $callback) { $callback(); } class A { function great($name) { return 'Hello ' . $name; } } demo(new class () extends A { public function __invoke() { echo $this->great(get_class()); } });
based on QlriP
Output for 7.2.0
Hello class@anonymous/in/MNhUc0x7f46a5be20fb
Output for 7.1.10
Hello class@anonymous/in/MNhUc0x7f623dcb20fb
Output for 7.1.7
Hello class@anonymous/in/MNhUc0x7fd223ef50fb
Output for 7.1.6
Hello class@anonymous/in/MNhUc0x7f09d7d840fb
Output for 7.1.5
Hello class@anonymous/in/MNhUc0x7ff6f52ff0fb
Output for 7.1.0
Hello class@anonymous/in/MNhUc0x7f307d6a20fb
Output for 7.0.20
Hello class@anonymous/in/MNhUc0x7f59169fa0fb
Output for 7.0.6
Hello class@anonymous/in/MNhUc0x7f54bf5660fb
Output for 7.0.5
Hello class@anonymous/in/MNhUc0x7fd08269f0fb
Output for 7.0.4
Hello class@anonymous/in/MNhUc0x7fbaddd2a0fb
Output for 7.0.3
Hello class@anonymous/in/MNhUc0x7f0e4a6850fb
Output for 7.0.2
Hello class@anonymous/in/MNhUc0x7f0b215940fb
Output for 7.0.1
Hello class@anonymous/in/MNhUc0x7fc3edb190fb
Output for 7.0.0
Hello class@anonymous/in/MNhUc0x7ffa2d1110fb
Output for 5.4.2 - 5.6.28
Parse error: syntax error, unexpected 'class' (T_CLASS) in /in/MNhUc on line 14
Process exited with code 255.
Output for 5.3.18 - 5.3.29
Parse error: syntax error, unexpected T_CLASS in /in/MNhUc on line 14
Process exited with code 255.