Reply to Re: concatanate 2 strings

Your name:

Reply:


Posted by Norman Peelman on 11/11/96 11:19

"luke" <lduncalfe@eml.nope> wrote in message
news:ulaue.9436$U4.1244811@news.xtra.co.nz...
>
> Not wanting to repeat what has been written, but I think someone should
> point out that the concatenation of global variables has to be done with
the
> . (dot) operator, whereas using local variables, like you have, you can
> directly stick strings together _or_ use the . operator.
>
> So these are all ok:
>
> $bigstring = "$first $second";
> $bigstring = "$first some non variable text $second";
> $bigstring = $first . $second;
> $bigstring = $first . " some non variable text " . $second;
>
> But with globals only . concatenation is ok:
>
> $bigstring = $_POST['Name'] . $_POST['Email'];
> $bigstring = "normal text with $localvariable" . $_POST['Name'] . "more
> text";
>
> (above code has not been tested in real-life) :>
>

This is fine and works perfectly (you can drop the quotes around the key
name when inside double quotes):

$localvariable = 'white background';
//$_POST['Name'] previously set to 'John'
$bigstring = "normal text with $localvariable for $_POST[Name] to read.";

outputs: normal text with white background for John to read.

and...

$localvariable = 'white background';
//$_POST['Name'] previously set to 'John'
$bigstring = "normal text with $localvariable for '$_POST[Name]' to read.";

outputs: normal text with white background for 'John' to read.


Norm
--
FREE Avatar hosting at www.easyavatar.com

[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

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