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) {} } $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; printf("'===' was faster by %.2d percent.", $p); } else { $p = ($time2-$time1)/$time1; printf("'!' was faster by %.2d percent.", $p); }
Output for 5.0.0, 5.1.3 - 5.3.17, 5.3.19 - 5.4.18, 5.4.20 - 5.4.27, 5.4.29 - 5.5.33, 5.5.35 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
'===' was faster by 0 percent.
Output for 5.3.18, 5.4.19, 5.4.28, 5.5.34
'===' was faster by 1 percent.
Output for 4.3.0 - 4.4.9, 5.0.1 - 5.1.2
'!' was faster by 0 percent.