Result: DiscardedThe test labeled "preg_match()" was the faster by 0.0775 seconds, (5.146% faster)
The preg_match() test took 1.4291 seconds.
The strpos() test took 1.5066 seconds.
Each test case ran 20 random code order iterations consisting of 283,686 loops for a total of 5,673,720 runs.
- Line execution difference (0.000014) milliseconds.
- Avg difference (3.876) milliseconds per 283,686 loops.
- Total difference 77.52 milliseconds for 5,673,720 loops
The iteration variablity for Code 1 was (12.3392) milliseconds and Code 2 was (9.3714) 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;