How to concatenate string in PHP?

Posted by

A string is a collection of characters. It offers various types of string operators and these operators have different functionalities such as string concatenation, compare values and to perform Boolean operations. PHP string concatenation operator is used to concatenate the strings in PHP.

Concatenation Operator(.)

In php, this operator is used to combine the two string values and returns it as a new string.

example

<?php
 
$a = 'this  ';  // First String
 

$b = 'is  ';   // Second String

$d = 'the example of concetenation of strings';  // Third String
 

$c = $a.$b.$d;
 
echo " $c \n";
?>

output

this is the example of concetenation of strings
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x