3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php abstract class A { public function getName() { return '42'; } } class B extends A {} echo (new A)->getName(); echo (new B)->getName();
based on Cf9Ul
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught Error: Cannot instantiate abstract class A in /in/YSpRr:11 Stack trace: #0 {main} thrown in /in/YSpRr on line 11
Process exited with code 255.
Output for 5.4.2 - 5.6.28
Fatal error: Cannot instantiate abstract class A in /in/YSpRr on line 11
Process exited with code 255.
Output for 5.3.18 - 5.3.29
Parse error: syntax error, unexpected T_OBJECT_OPERATOR, expecting ',' or ';' in /in/YSpRr on line 11
Process exited with code 255.