PHP Benchmarks

Performance comparison of PHP code alternatives.

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

No Description

Run this test again Return to test menu

Result: Discarded

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

<?php ?> 100%
echo 99.827%

The <?php ?> test took 1.4262 seconds.
The echo test took 1.4287 seconds.


Each test case ran 20 random code order iterations consisting of 285,229 loops for a total of 5,704,580 runs.

  • Line execution difference (0.000000) milliseconds.
  • Avg difference (0.124) milliseconds per 285,229 loops.
  • Total difference 2.47 milliseconds for 5,704,580 loops

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