Re: combining values

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux