PHP Benchmarks

Performance comparison of PHP code alternatives.

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

No Description

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

Result: Discarded

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

<?php ?> 100%
echo 96.184%

The <?php ?> test took 1.1384 seconds.
The echo test took 1.1836 seconds.


Each test case ran 20 random code order iterations consisting of 282,921 loops for a total of 5,658,420 runs.

  • Line execution difference (0.000008) milliseconds.
  • Avg difference (2.259) milliseconds per 282,921 loops.
  • Total difference 45.17 milliseconds for 5,658,420 loops

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