Result: Discarded
The test labeled "strpos()/strtolower()" was the faster by 0.0184 seconds, (3.569% faster)
The strpos()/strtolower() test took 0.4975 seconds.
The stripos() test took 0.5159 seconds.
Nitty-Gritty
Each test case ran 20 random code order iterations consisting of 124,220 loops for a total of 2,484,400 runs.
- Line execution difference (0.000007) milliseconds.
- Avg difference (0.921) milliseconds per 124,220 loops.
- Total difference 18.41 milliseconds for 2,484,400 loops
The iteration variablity for Code 1 was (3.2394) milliseconds and Code 2 was (4.6122) milliseconds. The lower and the closer together there values are the more accurate the results are.
Code
The first test, "strpos()/strtolower()", was:
for ($j = 0; $j < 40; $j++) $GLOBALS['dummy'] = strpos(strtolower($GLOBALS['dummy_match']), '9abcd') === 5; for ($j = 0; $j < 40; $j++) $GLOBALS['dummy'] = strpos(strtolower($GLOBALS['dummy_fail']), '9abcd') === 5;
The second test, "stripos()", was:
for ($j = 0; $j < 40; $j++) $GLOBALS['dummy'] = stripos($GLOBALS['dummy_match'], '9abcd') === 5; for ($j = 0; $j < 40; $j++) $GLOBALS['dummy'] = stripos($GLOBALS['dummy_fail'], '9abcd') === 5;