Search code snippets, questions, articles...

Join or concatenate two or multiple strings in PHP

You can use the dot(.) operator of PHP to join or concatenate multiple strings into one.
<?php
  $str1 = "We are ";
  $str2 = "Devsheet ";
  $str3 = "Programmers";
  
  $result1 = $str1 . $str2;
  //-> We are Devsheet 
  
  $result2 = $str1 . $str2 . $str3;
  //-> We are Devsheet Programmers
?>
Best JSON Validator, JSON Tree Viewer, JSON Beautifier at same place.

Search Index Data (The code snippet can also be found with below search text)

add two strings PHP
Was this helpful?
0 Comments