|
Posted by L. Berger on 05/30/07 23:28
> The fastest would be something like
> echo 'some text ', $aVar, ' some more text ', $anotherVar;
>
Thanks, I had no idea echo could work with simple commas! Some testing
with microtime (just back of the envelope, nothing scientific) reveals
that it is indeed the fastest. Here's what I had:
OPTION 1: echo 'something and more' . $i . $i+100 . 'something else
and then some';
OPTION 2: echo 'something and more' , $i , $i+100 , 'something else
and then some';
OPTION 3: something and more' <?php echo $i; ?><?php echo $i+100; ?
>something else and then some
Option 2 outperforms the others. 1 and 2 are almost the same, but 2 is
usually just a little bit faster, especially for more variables.
Option 3, which calls echo many times is markedly slower.
Hope this helps someone!
Navigation:
[Reply to this message]
|