For those who are looking for optimization, try using buffered output.
I noticed that an output function call (i.e echo()) is somehow time expensive. When using buffered output, only one output function call is made and it seems to be much faster.
Try this :
<?php
your_benchmark_start_function();
for ($i = 0; $i < 5000; $i++)
echo str_repeat ("your string blablabla bla bla", (rand() % 4) + 1)."<br>\n";
echo your_benchmark_end_function();
?>
And then :
<?php
your_benchmark_start_function();
ob_start ();
for ($i = 0; $i < 5000; $i++)
echo str_repeat ("your string blablabla bla bla", (rand() % 4) + 1)."<br>\n";
echo your_benchmark_end_function();
ob_end_flush ();
?>