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; } } $son = new Son('Nick', 'Long'); $son->whatIsMyName(); $son->drive();
based on WfsDs
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught Error: Call to protected method Dad::drive() from context '' in /in/qEX7T:40 Stack trace: #0 {main} thrown in /in/qEX7T on line 40
Process exited with code 255.
Output for 5.3.19 - 5.6.28
Fatal error: Call to protected method Dad::drive() from context '' in /in/qEX7T on line 40
Process exited with code 255.