Re: arrays and php
| From: | CPT John W. Holmes | Date: | Tue, 30 Sep 2003 18:31:46 +0000 |
| Subject: | Re: arrays and php | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-164436@lists.php.net to get a copy of this message | ||
From: "Chris W. Parker" <cparker@swatgear.com>
>>> echo "<pre>".print_r($chk)."</pre>";
>>>
>>> It will not work.
>>
>> You can do this though:
>>
>> echo "<pre>", print_r($chk), "</pre>";
>
>Well heck, that makes things easier!
>
>What's the difference between using , or . for concatenation? (I thought
>they were the same.)
Using a comma is just like using another echo command. So for the above,
you're effectively saying:
echo "<pre>"; echo print_r($chk); echo "</pre>";
Note that print_r() will (by default) return a 1 (TRUE) upon success, so you
end up with a "1" being printed at the end of your data.
You could also use this method:
echo "<pre>".print_r($chk,TRUE)."</pre>";
The TRUE causes the output of print_r() to be returned instead of printed
automatically. The benefit to this method is that you don't end up with the
"1" being printed.
---John Holmes...