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 huKYe
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught Error: Closure object cannot have properties in /in/nknUH:33 Stack trace: #0 {main} thrown in /in/nknUH on line 33
Process exited with code 255.
Output for 5.3.20 - 5.6.28
Catchable fatal error: Closure object cannot have properties in /in/nknUH on line 33
Process exited with code 255.