PHP Benchmarks

Performance comparison of PHP code alternatives.

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

No Description

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

Result: Discarded

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

<?php ?> 100%
echo 98.237%

The <?php ?> test took 0.5284 seconds.
The echo test took 0.5378 seconds.


Each test case ran 20 random code order iterations consisting of 145,698 loops for a total of 2,913,960 runs.

  • Line execution difference (0.000003) milliseconds.
  • Avg difference (0.474) milliseconds per 145,698 loops.
  • Total difference 9.48 milliseconds for 2,913,960 loops

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