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[7] = $oB; } } class B { public $a = false; function __construct($oA) { $this->a[7] = $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[7]()->e);
based on 8LtXo
Output for 5.3.20 - 7.2.0
int(12)