3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Simple { private $complicated; public function setComplicated(Complicated $complicated) { $this->complicated = $complicated; } public function __construct() { echo 'test1 '; } public function __destruct() { echo 'exit1 '; } } //Допустим есть еще некий класс Complicated, который может в себе содержать ссылку на класс Simple. class Complicated { private $simple; public function setSimple(Simple $simple) { $this->simple = $simple; } public function __construct() { echo 'test2 '; } public function __destruct() { echo 'exit2 '; } } $simple = new Simple(); $complicated = new Complicated(); $simple->setComplicated($complicated); $complicated->setSimple($simple); unset($simple); unset($complicated);] gc_collect_cycles(); echo 'end';
based on 3Z5Jb
Output for 7.0.0
Parse error: syntax error, unexpected ']', expecting end of file in /in/l574j on line 52
Process exited with code 255.
Output for 5.3.20 - 5.6.16
Parse error: syntax error, unexpected ']' in /in/l574j on line 52
Process exited with code 255.