On 12/01/11 14:13, Richard Quadling wrote:
On 12 January 2011 14:07, Steve Staples<sstap...@mnsi.net>  wrote:
On Wed, 2011-01-12 at 13:40 +0000, Richard Quadling wrote:
On 12 January 2011 13:20, Steve Staples<sstap...@mnsi.net>  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.



I was never taught by nuns.


Eh? Oh I get it... (ugh!)
Surely PHP-fu is taught by monks?

--
Peter Ford, Developer                 phone: 01580 893333 fax: 01580 893399
Justcroft International Ltd.                              www.justcroft.com
Justcroft House, High Street, Staplehurst, Kent   TN12 0AH   United Kingdom
Registered in England and Wales: 2297906
Registered office: Stag Gates House, 63/64 The Avenue, Southampton SO17 1XS

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

Reply via email to