- microtime: documentation ( source)
- test1: documentation ( source)
- test2: documentation ( source)
<?php
function test1() {
$str = 'derp';
if ($str != 'files' && $str != 'something' && $str != 'Derrr') {
return;
}
return;
}
function test2() {
$str = 'derp';
switch ($str) {
case 'files':
case 'something':
case 'Derrr':
break;
default:
return;
}
return;
}
$start = microtime(1);
for ($i = 1; $i < 10000; $i++) {
test1();
}
$start -= microtime(1);
echo "test1: $start";
$start = microtime(1);
for ($i = 1; $i < 10000; $i++) {
test2();
}
$start -= microtime(1);
echo "test2: $start";