Your full service technology partner! 
-Collapse +Expand
Search PHP Group:

-Collapse +Expand PHP Store
   ► KBTo/From GuidesReferencePHPOperators  Print This    All Groups  

PHP Operators

String Concatenation

PHP:  "String Concatenation" .

PHP uses a period (.) known as a dot to concatenate strings.

Syntax Example:
$fname = "Mike";
$lname = "Prestwood";

$fullname = $fname . $lname . "

echo "My name is " . "Mike.

Here's a complete example that demonstrates a few string concepts:

//Now using quotes.
$fname = "Mike";
$lname = "Prestwood";

$fullname = $fname . $lname;

echo $fullname . '<br>';

//Two literals too:
echo "My name is " . "Mike.<br>";

//Long strings.
$MyMsg = "This is a long string and
unlike some other languages. PHP allows
you to put strings on multiple lines
like this.";

echo $MyMsg;

More Info

Code:  PHP String Concatenation (.)

Go ahead!   Use Us! Call: 916-726-5675  Or visit our new sales site:

©1995-2021 Prestwood IT Solutions.   [Security & Privacy]