PHP Benchmarks

Performance comparison of PHP code alternatives.

Test: foreach reference writing

No Description

Run this test again Return to test menu

Historical Results

Based on (7) saved test runs, The test labeled "referenced" was (on average) the faster by 0.0013 seconds, (0.147% faster)

referenced 100%
non-referenced 99.853%

The referenced test took 0.8989 seconds.
The non-referenced test took 0.9002 seconds.


Each test case ran 20 random code order iterations consisting of 225,620 loops for a total of 4,512,400 runs.

  • Line execution difference (0.000000) milliseconds.
  • Avg difference (0.000) milliseconds per 225,620 loops.
  • Total difference 1.32 milliseconds for 4,512,400 loops

The iteration variablity for Code 1 was (0.0000) milliseconds and Code 2 was (0.0000) milliseconds. The lower and the closer together there values are the more accurate the results are.


The first test, "non-referenced", was:

foreach ($GLOBALS['dummy'] as $k => $v)

The second test, "referenced", was:

foreach ($GLOBALS['dummy'] as $k => &$v)

Running: Linux (x86_64:1 GB) PHP (