<?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.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.16, 5.3.18 - 5.3.28, 5.4.0 - 5.4.26, 5.4.28, 5.4.31 - 5.4.33, 5.4.35 - 5.4.41, 5.4.44 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.7, 5.6.9 - 5.6.18, 5.6.20 - 5.6.34, 5.6.36 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.9, 7.1.11 - 7.1.33, 7.2.1 - 7.2.25, 7.3.0 - 7.3.12, 7.4.0
- '===' was faster by 0 percent.
- Output for 5.3.29, 5.4.29, 5.4.34, 5.4.42, 5.6.19, 5.6.35, 7.2.0
- '===' was faster by 1 percent.
- Output for 5.4.27, 5.4.30, 5.6.8, 7.1.10
- '===' was faster by 2 percent.
- Output for 4.3.0 - 4.3.11, 4.4.0 - 4.4.9, 5.0.1 - 5.0.5, 5.1.0 - 5.1.2, 5.3.17, 5.4.43
- '!' was faster by 0 percent.
preferences:
216.73 ms | 402 KiB | 322 Q