3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class C { public function __destruct() { echo sprintf('%s destroyed', __CLASS__) . PHP_EOL; } } function f(C $c) { echo __FUNCTION__ . PHP_EOL; } function g(C $c) { unset($c); echo __FUNCTION__ . PHP_EOL; } f(new C()); g(new C());
Output for hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
f C destroyed C destroyed g
Output for 5.0.2 - 5.6.28
f C destroyed g C destroyed
Output for 5.0.0 - 5.0.1
Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/GVSV1 on line 11 fPHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/GVSV1 on line 5 C destroyedPHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/GVSV1 on line 17 gPHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/GVSV1 on line 5 C destroyedPHP_EOL
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/GVSV1 on line 4
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/GVSV1 on line 4
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/GVSV1 on line 4
Process exited with code 255.