PHP Benchmarks

Performance comparison of PHP code alternatives.

Test: echo vs. ?>...<?php (dynamic)

No Description

View test history (4) Run this test again Return to test menu

Result: Discarded

The test labeled "echo" was the faster by 0.0378 seconds, (5.268% faster)

echo 100%
<?php ?> 94.732%

The echo test took 0.6806 seconds.
The <?php ?> test took 0.7184 seconds.


Each test case ran 20 random code order iterations consisting of 137,676 loops for a total of 2,753,520 runs.

  • Line execution difference (0.000014) milliseconds.
  • Avg difference (1.892) milliseconds per 137,676 loops.
  • Total difference 37.85 milliseconds for 2,753,520 loops

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


The first test, "echo", was:

echo $GLOBALS['x'], ' test ', $GLOBALS['y'], $GLOBALS['z'], ' test ';

The second test, "<?php ?>", was:

echo $GLOBALS['x']; ?> test <?php echo $GLOBALS['y'], $GLOBALS['z'];?> test <?php

Running: Linux (x86_64:1 GB) PHP (