3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Foo { protected $_foo = 'foo'; public function isMatch() { var_dump($this->_foo); var_dump(parent::$_foo); } } class Bar extends Foo { protected $_foo = 'bar'; } $a = new Bar(); var_dump($a->isMatch());
based on HnCJe
Output for 7.0.0 - 7.2.0
string(3) "bar" Fatal error: Uncaught Error: Cannot access parent:: when current class scope has no parent in /in/itELE:8 Stack trace: #0 /in/itELE(17): Foo->isMatch() #1 {main} thrown in /in/itELE on line 8
Process exited with code 255.
Output for 5.3.17 - 5.6.28
string(3) "bar" Fatal error: Cannot access parent:: when current class scope has no parent in /in/itELE on line 8
Process exited with code 255.