<?php
class C {
public function __construct() {
$this->b = new B($this);
}
public function __destruct() {
echo 'c destructing!';
}
}
class B {
public function __construct($C){
$this->c = $c;
}
public function __destruct() {
echo 'b destructing!';
}
}
$c = new C;
die();
Warning: Undefined variable $c in /in/kIRj1 on line 13
Deprecated: Creation of dynamic property B::$c is deprecated in /in/kIRj1 on line 13
Deprecated: Creation of dynamic property C::$b is deprecated in /in/kIRj1 on line 4
c destructing!b destructing!
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28
Warning: Undefined variable $c in /in/kIRj1 on line 13
c destructing!b destructing!
Notice: Undefined variable: c in /in/kIRj1 on line 13
c destructing!b destructing!
Output for 7.3.32 - 7.3.33, 7.4.26
c destructing!b destructing!
Output for 5.0.0 - 5.0.3
Notice: Undefined variable: c in /in/kIRj1 on line 13
c destructing!b destructing!
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/kIRj1 on line 3
Process exited with code 255.
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/kIRj1 on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/kIRj1 on line 3
Process exited with code 255.