RE: [PHP] Comma question
| From: | Martin Towell | Date: | Mon, 22 Jul 2002 23:14:47 +0000 |
| Subject: | RE: [PHP] Comma question | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-108957@lists.php.net to get a copy of this message | ||
I remember from a previous post, the dot operator will create a temporary
string in memory, and then echo that out. The comma operator will just
output as it goes - ie. it doesn't create a temporary string.
As for Lee Doolan's reply:
echo "<tr><td>{$obj->strName[$i]}</td></tr>";
interesting - never thought of doing that, I alway's broke out of the quotes
to do object dereferencing. Should make my future code more readable I
think...
Martin
-----Original Message-----
From: B i g D o g [mailto:bigdog@venticon.com]
Sent: Tuesday, July 23, 2002 9:06 AM
To: PHP GEN
Subject: Re: [PHP] Comma question
Thanks all for the info...
I figured that the comma was to concatenate but is was wondering if the
parser handled it different.
I knew the {} helped the parser now which was the variable...but i have
never seen it like that...
I have only seen it like ${var}...
Just wondering the difference...
.: B i g D o G :.
----- Original Message -----
From: "Kevin Stone" <kevin@helpelf.com>
To: "B i g D o g" <bigdog@venticon.com>; "PHP GEN"
<php-general@lists.php.net>
Sent: Monday, July 22, 2002 5:00 PM
Subject: Re: [PHP] Comma question
> Curly braces {} are sometimes required for PHP to properly parse variables
> within quoted strings. Good example might be defining variable-variables
> within a quoted string "${$myvarvar}". However I do not believe that
curly
> braces are required in this particular string.
>
> As for the comma I believe it does the same thing as the period. It will
> concatonate the quoted string with the output of the htmlspecialchars()
> function within the echo statement.
>
> -Kevin
>
> ----- Original Message -----
> From: "B i g D o g" <bigdog@venticon.com>
> To: "PHP GEN" <php-general@lists.php.net>
> Sent: Monday, July 22, 2002 4:34 PM
> Subject: [PHP] Comma question
>
>
> > Tried to check the archive, but it is offline...
> >
> >
> > What does the "," and "{}" do in this type of statement?
> >
> > Example: echo "<tr><td>{$strName}</td></tr>",
> > htmlspecialchars(
> $teststr );
> >
> > Thanks,
> >
> >
> > .: B i g D o g :.
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php