Click here to get back home

$string .= $new vs $string = $string . $new performance

 HomeNewsGroups | Search | About
 comp.lang.php    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
$string .= $new vs $string = $string . $new performance Leigh Finch 07-03-2008
Posted by Leigh Finch on July 3, 2008, 6:41 pm
Please log in for more thread options
Hey Guys,
Quick question about the PHP compiler, is there any performance
difference between

$string .= $new;

and

$string = $string . $new;

Does the compiler see them as equivalent and optimize to the later, or
does concatenate and then copy?

Can anyone point me to some documentation on this, I havent been able to
find anything on this particular topic?

Cheers
Leigh Finch

Posted by Michael Fesser on July 3, 2008, 6:48 pm
Please log in for more thread options
.oO(Leigh Finch)

>Quick question about the PHP compiler, is there any performance
>difference between
>
>$string .= $new;
>
>and
>
>$string = $string . $new;
>
>Does the compiler see them as equivalent and optimize to the later, or
>does concatenate and then copy?

Don't worry and google "premature optimization" if you want to.

Micha

Similar ThreadsPosted
Search for string and then take string next to it. November 1, 2004, 9:14 am
How do I see if one string is found within another string? August 12, 2005, 5:45 pm
cut off a string? June 30, 2005, 9:49 am
does a string come before or after another January 20, 2006, 2:17 pm
dec to string June 15, 2007, 10:05 pm
echo a string that contain July 20, 2004, 8:15 am
KEYWORDS from a string July 22, 2004, 9:43 pm
cropping a string July 30, 2004, 4:25 pm
string replace August 16, 2004, 10:10 am
String manipulation. August 20, 2004, 12:53 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap