IT SOLUTIONS
Your full service technology partner! 
-Collapse +Expand
To/From Code
   ► KBTo/From GuidesReferencePHPOperators  Print This     

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:

<?PHP
//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 (.)




Sales Website: www.prestwood.com Or visit our legacy sales site: 
legacy.prestwood.com


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