Re: HTML errors

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

 



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.

-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

-- 
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