Re: HTML errors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2011-01-12 at 13:40 +0000, Richard Quadling wrote:
> On 12 January 2011 13:20, Steve Staples <sstaples@xxxxxxxx> wrote:
> > Jim,
> >
> > Not to be a smart ass like Danial was (which was brilliantly written
> > though),  but you have your "example" formatted incorrectly.  You are
> > using commas instead of periods for concatenation, and it would have
> > thrown an error trying to run your example. :)
> >
> > # corrected:
> > echo "<li><a href=\"index.php?page={$category}\">{$replace}</a></li>";
> >
> > Steve Staples.
> 
> Steve,
> 
> The commas are not concatenation. They are separators for the echo construct.
> 
> I don't know the internals well enough, but ...
> 
> echo $a.$b.$c;
> 
> vs
> 
> echo $a, $b, $c;
> 
> On the surface, the first instance has to create a temporary variable
> holding the results of the concatenation before passing it to the echo
> construct.
> 
> In the second one, the string representations of each variable are
> added to the output buffer in order with no need to create a temp var
> first.
> 
> So, I think for large strings, using commas should be more efficient.
> 
> Richard.
> 

Well... I have been learned.  I had no idea about doing it that way, I
apologize to you, Jim.

I guess my PHP-fu is not as strong as I had thought?

Thank you Richard for pointing out this to me,  I may end up using this
method from now on.  I have just always concatenated everything as a
force of habit.

Steve Staples.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux