How to use join in PHP

In this article I will explain how the join() function can be used in PHP.
  • 1638

join() function in PHP

  • The join() function returns a string from the elements of an array.
  • The join() function is an alias of the implode() function.
  • The join() function accept its parameters in either order.
  • The separator parameter of join() is optional.




  • separator separator is required parameter. separator puts between the array elements, the default value is an empty string.
  • array array is optional parameter. array to join into string.


The following example show to how the join() function can be used in PHP.



<h3 style="color: blueviolet;">join() function example in PHP</h3>



    echo"Apply join function with ',' <br/>";

    $join_string=join(",", $array);

    echo $join_string;

    echo '<br>';

    echo"Apply join function with '-' <br/>";


    $join_string=join("-", $array);

    echo $join_string;






You may also want to read these related articles here
Ask Your Question 
Got a programming related question? You may want to post your question here


More Articles

© 2020 DotNetHeaven. All rights reserved.