3v4l.org

run code in 300+ PHP versions simultaneously
<?php //$var = 'A'; //$var = ''; //$var = null; $var = 0; $f1 = function($var) { if (! isset($var) || $var) { //echo "set default"; //"not empty or not defiend or a null value"; } else { //echo "not default"; //"empty"; } } $f2 = function($var) { if (! isset($var) || ! empty($var)) { //echo "set default"; } else { //echo "not default"; } } $s = microtime(1); for ($i = 0; $i < 100; $i++) { $f1($var); } echo microtime(1) - $s;
Output for 5.4.0 - 5.4.19, 5.5.0 - 5.5.3
Parse error: syntax error, unexpected '$f2' (T_VARIABLE) in /in/iYdb0 on line 14
Process exited with code 255.
Output for 5.3.0 - 5.3.27
Parse error: syntax error, unexpected T_VARIABLE in /in/iYdb0 on line 14
Process exited with code 255.

preferences:
177.82 ms | 1395 KiB | 59 Q