Result: SavedThe test labeled "preg_match()" was the faster by 0.0194 seconds, (3.408% faster)
The preg_match() test took 0.5499 seconds.
The strpos() test took 0.5693 seconds.
Each test case ran 20 random code order iterations consisting of 127,797 loops for a total of 2,555,940 runs.
- Line execution difference (0.000008) milliseconds.
- Avg difference (0.970) milliseconds per 127,797 loops.
- Total difference 19.40 milliseconds for 2,555,940 loops
The iteration variablity for Code 1 was (4.2179) milliseconds and Code 2 was (4.3501) 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;