3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php abstract class Engine { protected $engine = 'AbstractEngine'; public function engine() { return $this->engine; } } class Car extends Engine { } // $car = new Car(); // echo $car->engine(); $engine = new Engine(); echo $engine->engine();
based on 2EZNj
Output for 7.0.0 - 7.2.0
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Engine has a deprecated constructor in /in/BfjpA on line 2 Fatal error: Uncaught Error: Cannot instantiate abstract class Engine in /in/BfjpA:20 Stack trace: #0 {main} thrown in /in/BfjpA on line 20
Process exited with code 255.
Output for 5.4.0 - 5.6.28
Fatal error: Cannot instantiate abstract class Engine in /in/BfjpA on line 20
Process exited with code 255.