NYCPHP Meetup

NYPHP.org

[nycphp-talk] testing a theory

Ben Sgro (ProjectSkyline) ben at projectskyline.com
Tue Feb 6 18:47:58 EST 2007


Well,

My guess (no facts here) would be the first is slower.

First the "'s need to be checked for $variables, it would be quicker to put 
'.
And then an operation of copying needs to be done. Allocation as well on the 
c side
for the new, larger variable.

Then the display.

The second snippet displays the lines without the additional operation of 
allocation/concatenation.

Who knows though..I'd like a more fact based explanation.

- Ben
----- Original Message ----- 
From: "Adrian Noland" <anoland at indigente.net>
To: <talk at lists.nyphp.org>
Sent: Tuesday, February 06, 2007 6:39 PM
Subject: [nycphp-talk] testing a theory


> Hi, I have a quick (and probably silly) question. Is there performance
> difference between the following two snippets. Does it make a
> difference if there are hundreds+ of lines?
>
> <?php
> $content = "this is the start of a bunch of lines";
> $content .= "another line";
> $content .= "yet another";
> echo $content;
> ?>
>
> vs.
>
> <?php
> echo "this is the start of a bunch of lines";
> echo "another line";
> echo "yet another";
> ?>
> _______________________________________________
> New York PHP Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
>
> NYPHPCon 2006 Presentations Online
> http://www.nyphpcon.com
>
> Show Your Participation in New York PHP
> http://www.nyphp.org/show_participation.php
> 




More information about the talk mailing list