3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Dad { protected $name; protected $surname; public function __consruct(string $name, string $surname) { $this->name = $name; $this->surname = $surname; } public function run() { echo 'I run fast'; } protected function drive() { echo 'I drive a car'; } } class Son extends Dad { protected function goToSchool() { echo 'I go to school'; } public function whatIsMyName() { echo $this->name; } } $dad = new Dad('a', 'b'); $dad->gotToSchool(); $son = new Son('Nick', 'Long'); $son->drive(); //produce an error
based on LBYTg
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught Error: Call to undefined method Dad::gotToSchool() in /in/WfsDs:38 Stack trace: #0 {main} thrown in /in/WfsDs on line 38
Process exited with code 255.
Output for 5.3.19 - 5.6.28
Fatal error: Call to undefined method Dad::gotToSchool() in /in/WfsDs on line 38
Process exited with code 255.