RE: [PHP] arrays and php
| From: | Chris W. Parker | Date: | Tue, 30 Sep 2003 19:04:43 +0000 |
| Subject: | RE: [PHP] arrays and php | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-164444@lists.php.net to get a copy of this message | ||
Chris Shiflett <mailto:shiflett@php.net>
on Tuesday, September 30, 2003 11:39 AM said:
> The comma isn't concatenation; echo can take multiple arguments.
Oh ok, I get it.
> I've heard statements about passing multiple arguments to echo being
> faster than using concatenation, but every benchmark I've tried
> myself shows them to be nearly identical. Feel free to try it
> yourself and post your results. :-) I'd be curious to see if others
> reach the same conclusion.
I tried this, and I think the comma was just slightly faster than the
period. But then again I didn't always get consistent results because I
was trying this out on a machine that is not very fast so the speed at
which is processes something varies quite a bit.
My conclusion was that it's not fast enough to bother changing all my
code, or start writing in a new way.
Although during some testing I did find that writing loops in the
following way is faster than normal.
$counter = -1;
while(++$counter < $amount)
{
// do stuff
}
It made a big enough difference on my slow machine to merit me writing
as many loops in this way as I can. (I think.)
Chris.