3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class Foo { public $bar = 'baz'; function destroy() { unset($this); var_dump($this); } } $foo = new Foo(); $foo->destroy(); var_dump($foo); unset($foo); var_dump($foo);
Output for 7.1.0
Fatal error: Cannot unset $this in /in/FWOVZ on line 8
Process exited with code 255.
Output for 5.5.0 - 7.0.14
Notice: Undefined variable: this in /in/FWOVZ on line 9 NULL object(Foo)#1 (1) { ["bar"]=> string(3) "baz" } Notice: Undefined variable: foo in /in/FWOVZ on line 17 NULL
Output for 5.0.0 - 5.4.45
NULL object(Foo)#1 (1) { ["bar"]=> string(3) "baz" } NULL
Output for 4.4.2 - 4.4.9
<br /> <b>Parse error</b>: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in <b>/in/FWOVZ</b> on line <b>5</b><br />
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
<br /> <b>Parse error</b>: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in <b>/in/FWOVZ</b> on line <b>5</b><br />
Process exited with code 255.
Output for 4.3.2 - 4.3.4
<br /> <b>Parse error</b>: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in <b>/in/FWOVZ</b> on line <b>5</b><br />
Process exited with code 255.