Join() function in PHP || PHP Join Function

join() function in PHP

0 1410

Join() function of PHP is used to merge all array items into a single string. It is an inbuilt function of PHP. The working of this function is the same as the working of implode() PHP function.

The return type of this function is string means it always returns a string corresponding to a given PHP array.


join($separator, $array);


  • $separator is a separator which used to separate array items in resultant string.
  • $array is a PHP array.


$str1=join(",",$arr); // join array items by comma
$str2=join("-",$arr); // join array items by -
$str3=join(" ",$arr); // join array items by space
echo "$str1 <br>";
echo "$str2 <br>";
echo "$str3 <br>";


Best WordPress Hosting


Leave a Reply

    Waiting for your comments