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.
  $str1 = "We are ";
  $str2 = "Devsheet ";
  $str3 = "Programmers";
  $result1 = $str1 . $str2;
  //-> We are Devsheet 
  $result2 = $str1 . $str2 . $str3;
  //-> We are Devsheet Programmers

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

add two strings PHP
Was this helpful?
Programming Feeds
Learn something new everyday on Devsheet