3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class A { public $b = false; public $e = 12; function __construct($oB) { $this->b = $oB; } } class B { public $a = false; function __construct($oA) { $this->a = $oA; } } $aDepends = array(); $pLink = function() use (&$aDepends) { return $aDepends['A']; }; $oB = new B($pLink); $oA = new A($oB); $aDepends['A']=$oA; //$aDepends=$oA; //$oB->a = $oA; //var_dump($oA); //var_dump($oB); var_dump($oB->a()->e);
based on nknUH
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught Error: Call to undefined method B::a() in /in/sOUc1:33 Stack trace: #0 {main} thrown in /in/sOUc1 on line 33
Process exited with code 255.
Output for 5.3.20 - 5.6.28
Fatal error: Call to undefined method B::a() in /in/sOUc1 on line 33
Process exited with code 255.