Re: combining values
| From: | Leif Gregory | Date: | Tue, 01 Mar 2005 19:05:45 +0000 |
| Subject: | Re: combining values | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-209726@lists.php.net to get a copy of this message | ||
Hello Bret,
Tuesday, March 1, 2005, 11:43:18 AM, you wrote:
B> why wouldn't
B> $birthday = "$day.$month.$year";
B> work as well.
Because in PHP the unencapsulated period means to concatenate.
i.e.
$var1 = "Hello";
$var2 = "there";
$var3 = "Bret";
echo $var1 . $var2 . $var3;
Would net you:
HellothereBret
if you put:
echo $var1 . " " . $var2 . " " . $var3;
You'd get:
Hello there Bret
So, to put periods in something you have to encapsulate it with
quotes. So:
echo $var1 . "." . $var2 . "." . $var3;
would get you:
Hello.there.Bret
See?
--
Leif (TB lists moderator and fellow end user).
Using The Bat! 3.0.2.3 Rush under Windows XP 5.1
Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB