PHP Benchmarks

Performance comparison of PHP code alternatives.

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

No Description

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

Result: Discarded

The test labeled "<?php ?>" was the faster by 0.0195 seconds, (2.899% faster)

<?php ?> 100%
echo 97.101%

The <?php ?> test took 0.6542 seconds.
The echo test took 0.6738 seconds.


Each test case ran 20 random code order iterations consisting of 140,512 loops for a total of 2,810,240 runs.

  • Line execution difference (0.000007) milliseconds.
  • Avg difference (0.977) milliseconds per 140,512 loops.
  • Total difference 19.53 milliseconds for 2,810,240 loops

The iteration variablity for Code 1 was (8.5420) milliseconds and Code 2 was (6.9964) 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 (