You are here: Re: concatanate 2 strings « PHP Programming Language « IT news, forums, messages
Re: concatanate 2 strings

Posted by luke on 10/28/67 11:19

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) :>

Luke

"Desmond" <pd_otoole@hotmail.com> wrote in message
news:1119282029.932162.16230@f14g2000cwb.googlegroups.com...
> Can someone please tell me how to concatanate to strings like this
> please
>
>
> $name = $_POST["Name"];
> $from = $_POST["Email"];
>
> $headers = "From: $name $from\r\n";
>
> i beleve in C there is a strcat() is this similar.
> if so is there an online site for PHP function.
>
> Desmond.
>

 

Navigation:

[Reply to this 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

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