Reply to Re: [PHP] combining values

Your name:

Reply:


Posted by Leif Gregory on 03/01/05 21:05

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

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация