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 1RhSb
Output for 7.0.0 - 7.3.1
int(12)
Output for 5.3.20 - 5.6.28
Parse error: syntax error, unexpected '(' in /in/8LtXo on line 33
Process exited with code 255.