PHP Benchmarks

Performance comparison of PHP code alternatives.

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

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.0044 seconds, (0.687% faster)

<?php ?> 100%
echo 99.313%

The <?php ?> test took 0.6336 seconds.
The echo test took 0.638 seconds.

Nitty-Gritty

Each test case ran 20 random code order iterations consisting of 149,689 loops for a total of 2,993,780 runs.

  • Line execution difference (0.000001) milliseconds.
  • Avg difference (0.219) milliseconds per 149,689 loops.
  • Total difference 4.38 milliseconds for 2,993,780 loops

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

Code

The first test, "echo", was:

for ($j = 0; $j < 100; $j++)
	echo 'some text';

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

for ($j = 0; $j < 100; $j++)
{
	?>some text<?php
}

Running: Linux (x86_64:1 GB) PHP (7.2.22-1+ubuntu16.04.1+deb.sury.org+1)