3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { public $a = 1; public $b = 2; public $c = 3; } $t1 = new Test(); unset($t1->a); var_dump($t1); $t1->b = (unset) $t1->b; var_dump($t1);
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Fatal error: The (unset) cast is no longer supported in /in/uX5Sp on line 14
Process exited with code 255.
Output for 7.2.0 - 7.2.33, 7.3.16 - 7.3.31, 7.4.0 - 7.4.33
Deprecated: The (unset) cast is deprecated in /in/uX5Sp on line 14 object(Test)#1 (2) { ["b"]=> int(2) ["c"]=> int(3) } object(Test)#1 (2) { ["b"]=> NULL ["c"]=> int(3) }
Output for 5.5.24 - 5.5.35, 5.6.8 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.3.32 - 7.3.33
object(Test)#1 (2) { ["b"]=> int(2) ["c"]=> int(3) } object(Test)#1 (2) { ["b"]=> NULL ["c"]=> int(3) }

preferences:
165 ms | 403 KiB | 182 Q