3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public $classB, $classC; public function __construct(){ // Do stuff that should only be initialized once // Then later : $this -> classB = new B(); $this -> classC = new C(); } } Class B { public function __construct(){ } public function sayHi() { echo 'hi'; } } Class C extends A { public function __construct() { $this -> classB -> sayHi(); } } $test = new A();
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught Error: Call to a member function sayHi() on null in /in/SVBNm:25 Stack trace: #0 /in/SVBNm(9): C->__construct() #1 /in/SVBNm(29): A->__construct() #2 {main} thrown in /in/SVBNm on line 25
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
41.1 ms | 401 KiB | 8 Q