Result: Discarded
The test labeled "system()" was the faster by 0.0497 seconds, (4.204% faster)
The system() test took 1.1325 seconds.
The shell_exec() test took 1.1822 seconds.
Nitty-Gritty
Each test case ran 20 random code order iterations consisting of 284,987 loops for a total of 5,699,740 runs.
- Line execution difference (0.000009) milliseconds.
- Avg difference (2.485) milliseconds per 284,987 loops.
- Total difference 49.70 milliseconds for 5,699,740 loops
The iteration variablity for Code 1 was (7.2251) milliseconds and Code 2 was (9.4675) milliseconds. The lower and the closer together there values are the more accurate the results are.
Code
The first test, "system()", was:
system('ls');
The second test, "shell_exec()", was:
echo shell_exec('ls');