How to concatenate string in PHP?

Posted by

Upgrade & Secure Your Future with DevOps, SRE, DevSecOps, MLOps!

We spend hours scrolling social media and waste money on things we forget, but won’t spend 30 minutes a day earning certifications that can change our lives.
Master in DevOps, SRE, DevSecOps & MLOps by DevOps School!

Learn from Guru Rajesh Kumar and double your salary in just one year.


Get Started Now!

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