3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class A { function __construct() { parent::setA(); } function setA() { echo "class a"; } } class B extends A { function setA() { echo "class b"; } } new B;
Output for 7.0.0 - 7.1.0
Fatal error: Uncaught Error: Cannot access parent:: when current class scope has no parent in /in/VQcCb:7 Stack trace: #0 /in/VQcCb(24): A->__construct() #1 {main} thrown in /in/VQcCb on line 7
Process exited with code 255.
Output for 5.0.0 - 5.6.28
Fatal error: Cannot access parent:: when current class scope has no parent in /in/VQcCb on line 7
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Fatal error: No parent class available in /in/VQcCb on line 7
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: No parent class available in /in/VQcCb on line 7