3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class HasSuper { private $parentMethod; protected function super(... $args) { parent::$this->parentMethod(...$args); //It's out of scope } final public function __call($method, $arguments) { $this->parentMethod = $method; } } class Foo extends HasSuper { public function hello() { echo("Hello World!"); } } class Bar extends Foo { public function hello() { $this->super(); //How can it access Foo::hello() ? } } $bar = new Bar; $bar->hello();
based on Ms7R5
Output for 7.0.0 - 7.3.0alpha1
Fatal error: Uncaught Error: Cannot access parent:: when current class scope has no parent in /in/IvTsM:7 Stack trace: #0 /in/IvTsM(25): HasSuper->super() #1 /in/IvTsM(29): Bar->hello() #2 {main} thrown in /in/IvTsM on line 7
Process exited with code 255.
Output for hhvm-3.12.14 - 3.17.3
Fatal error: Uncaught Error: Cannot access parent:: when current class scope has no parent in /in/IvTsM:7 Stack trace: #0 /in/IvTsM(25): HasSuper->super() #1 /in/IvTsM(29): Bar->hello() #2 {main}
Process exited with code 255.
Output for 5.6.0 - 5.6.30
Fatal error: Cannot access parent:: when current class scope has no parent in /in/IvTsM on line 7
Process exited with code 255.