3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $times = 1000*100*10; $var = null; $var = 10; $var2 = '10'; $time1 = microtime(true); for ($i = 0; $i <= $times; $i++) { if ($var == $var2) {} } $time1 = microtime(true) - $time1; //echo "Time using '!': $time1\n"; $time2 = microtime(true); for ($i = 0; $i <= $times; $i++) { if ($var === $var2) {} } $time2 = microtime(true) - $time2; //echo "Time using '===': $time2\n"; if ($time1 > $time2){ $p = (($time1-$time2)/$time2) * 100; //printf("'===' was faster by %.2f percent.", $p); printf("'===' was faster"); } else { $p = (($time2-$time1)/$time1) * 100; //printf("'==' was faster by %.2f percent.", $p); printf("'==' was faster"); }
Output for 4.3.0 - 4.3.3, 4.3.5 - 4.3.8, 4.3.10 - 4.4.2, 4.4.4, 4.4.6, 4.4.8 - 7.1.0
'===' was faster
Output for 4.3.4, 4.3.9, 4.4.3, 4.4.5, 4.4.7
'==' was faster