How to concatenate two variables / String

There is only one string operator in PHP.

The concatenation operator (.)  is used to put two string values together.

To concatenate two variables together, use the dot (.) operator:

<?php
$txt1="Hello World";
$txt2="1234";
echo $txt1 . " " . $txt2;
?>

output

Hello World 1234

No comments:

Post a Comment