Result: DiscardedThe test labeled "strpos()" was the faster by 0.0231 seconds, (3.945% faster)
The strpos() test took 0.5617 seconds.
The preg_match() test took 0.5848 seconds.
Each test case ran 20 random code order iterations consisting of 140,031 loops for a total of 2,800,620 runs.
- Line execution difference (0.000008) milliseconds.
- Avg difference (1.154) milliseconds per 140,031 loops.
- Total difference 23.07 milliseconds for 2,800,620 loops
The iteration variablity for Code 1 was (1.9970) milliseconds and Code 2 was (1.2728) milliseconds. The lower and the closer together there values are the more accurate the results are.
The first test, "preg_match()", was:
if (preg_match('~http://www\.google\.com/~', $GLOBALS['dummy']) != 0) $GLOBALS['dummy2'] = 42;
The second test, "strpos()", was:
if (strpos($GLOBALS['dummy'], 'http://wwww.google.com/') !== false) $GLOBALS['dummy2'] = 42;