3v4l.org

run code in 300+ PHP versions simultaneously
<?php class B{ static $bobo; } class A{ function __destruct(){ echo "2: "; debug_zval_dump($this); B::$bobo = $this; echo "3: "; debug_zval_dump($this); unset(B::$bobo); echo "4: "; debug_zval_dump($this); } } $x = new A; echo "1: "; debug_zval_dump($x); unset($x);
Output for 7.1.0 - 7.1.23, 7.2.0 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.19, 8.3.0 - 8.3.7
1: object(A)#1 (0) refcount(2){ } 2: object(A)#1 (0) refcount(3){ } 3: object(A)#1 (0) refcount(4){ } Fatal error: Uncaught Error: Attempt to unset static property B::$bobo in /in/T1ohd:15 Stack trace: #0 /in/T1ohd(25): A->__destruct() #1 {main} thrown in /in/T1ohd on line 15
Process exited with code 255.
Output for 7.0.0 - 7.0.31
1: object(A)#1 (0) refcount(2){ } 2: object(A)#1 (0) refcount(4){ } 3: object(A)#1 (0) refcount(5){ } Fatal error: Uncaught Error: Attempt to unset static property B::$bobo in /in/T1ohd:15 Stack trace: #0 /in/T1ohd(25): A->__destruct() #1 {main} thrown in /in/T1ohd on line 15
Process exited with code 255.
Output for 5.5.0 - 5.5.38, 5.6.0 - 5.6.38
1: object(A)#1 (0) refcount(2){ } 2: object(A)#1 (0) refcount(4){ } 3: object(A)#1 (0) refcount(5){ } Fatal error: Attempt to unset static property B::$bobo in /in/T1ohd on line 15
Process exited with code 255.

preferences:
201.82 ms | 402 KiB | 288 Q