Re: Comma question
| From: | Miguel Cruz | Date: | Tue, 23 Jul 2002 05:11:56 +0000 |
| Subject: | Re: Comma question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-109031@lists.php.net to get a copy of this message | ||
On Mon, 22 Jul 2002, B i g D o g wrote:
> I figured that the comma was to concatenate but is was wondering if the
> parser handled it different.
The comma isn't actually for concatenation. The net effect is the same in
this case, but a very different thing is happening.
echo "hello " , "there";
Here 'echo' is printing two separate arguments. First it is printing
"hello " and then it is printing "there".
echo "hello " . "there";
Here the strings are concatenated to form a single string ("hello there")
and then this is processed by echo which prints it out.
The effects are the same, as I said, but it's important to realize why
they're very different ways of getting that effect.
miguel