Result: Discarded
The test labeled "preg_split()" was the faster by 0.0611 seconds, (5.572% faster)
The preg_split() test took 1.035 seconds.
The explode() test took 1.0961 seconds.
Nitty-Gritty
Each test case ran 20 random code order iterations consisting of 286,202 loops for a total of 5,724,040 runs.
- Line execution difference (0.000011) milliseconds.
- Avg difference (3.053) milliseconds per 286,202 loops.
- Total difference 61.07 milliseconds for 5,724,040 loops
The iteration variablity for Code 1 was (1.7504) milliseconds and Code 2 was (4.2716) milliseconds. The lower and the closer together there values are the more accurate the results are.
Code
The first test, "preg_split()", was:
$GLOBALS['dummy2'] = preg_split('~\r\n|\r|\n~', $GLOBALS['dummy']);
The second test, "explode()", was:
$GLOBALS['dummy2'] = explode("\n", str_replace(array("\r\n", "\r"), "\n", $GLOBALS['dummy']));