Re: HTML errors
| From: | Steve Staples | Date: | Wed, 12 Jan 2011 14:07:21 +0000 |
| Subject: | Re: HTML errors | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-310698@lists.php.net to get a copy of this message | ||
On Wed, 2011-01-12 at 13:40 +0000, Richard Quadling wrote:
> On 12 January 2011 13:20, Steve Staples <sstaples@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.