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();
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/2EZNj on line 2 AbstractEngine Fatal error: Uncaught Error: Cannot instantiate abstract class Engine in /in/2EZNj:20 Stack trace: #0 {main} thrown in /in/2EZNj on line 20
Process exited with code 255.
Output for 5.3.18 - 5.6.28
AbstractEngine Fatal error: Cannot instantiate abstract class Engine in /in/2EZNj on line 20
Process exited with code 255.