3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $times = 10000; $var = null; $var = new stdClass(); $time1 = microtime(true); for ($i = 0; $i <= $times; $i++) { if ($var instanceof stdClass) {} } $time1 = microtime(true) - $time1; //echo "Time using '!': $time1\n"; $time2 = microtime(true); for ($i = 0; $i <= $times; $i++) { if ($var !== null) {} } $time2 = microtime(true) - $time2; //echo "Time using '===': $time2\n"; if ($time1 > $time2){ $p = (($time1-$time2)/$time2) * 100; //printf("'!== null' was faster by %.2f percent.", $p); printf("'!== null' was faster"); } else { $p = (($time2-$time1)/$time1) * 100; //printf("'instanceof' was faster by %.2f percent.", $p); printf("'instanceof' was faster); }
Output for 5.4.0 - 5.4.14
Parse error: syntax error, unexpected end of file, expecting variable (T_VARIABLE) or ${ (T_DOLLAR_OPEN_CURLY_BRACES) or {$ (T_CURLY_OPEN) in /in/juCTV on line 37
Process exited with code 255.
Output for 5.3.0 - 5.3.24
Parse error: syntax error, unexpected $end, expecting T_VARIABLE or T_DOLLAR_OPEN_CURLY_BRACES or T_CURLY_OPEN in /in/juCTV on line 37
Process exited with code 255.