Result: Discarded
The test labeled "substr()" was the faster by 0.0163 seconds, (1.539% faster)
The substr() test took 1.0457 seconds.
The {5} test took 1.0621 seconds.
Nitty-Gritty
Each test case ran 20 random code order iterations consisting of 285,812 loops for a total of 5,716,240 runs.
- Line execution difference (0.000003) milliseconds.
- Avg difference (0.817) milliseconds per 285,812 loops.
- Total difference 16.35 milliseconds for 5,716,240 loops
The iteration variablity for Code 1 was (3.8225) milliseconds and Code 2 was (4.0810) milliseconds. The lower and the closer together there values are the more accurate the results are.
Code
The first test, "substr()", was:
for ($j = 0; $j < 100; $j++) $GLOBALS['dummy2'] = substr($GLOBALS['dummy'], 5, 1);
The second test, "{5}", was:
for ($j = 0; $j < 100; $j++) $GLOBALS['dummy2'] = $GLOBALS['dummy']{5};