PHP join() Function

PHP join() Function is used to join array elements into string.
The join() function is an alias of the implode() function.

Syntax :


PHP join() Function returns string with separator between two array elements.

Parameter Values,

PHP join() Function
Parameter Description
separator Optional. Join array elements with separator string.
Default value for separator is an empty string.
array Required. The array to join to a string.

Let's see below example to understand join() Function in details.

Example :

$arr = array('Learn','php','join()','function','by','aryatechno');
echo "<br> Join array element without separator :".implode($arr)."<br>";
echo "<br> Join array element by space :".implode(" ",$arr)."<br>";
echo "<br> Join array element by dash:".implode("-",$arr)."<br>";
echo "<br> Join array element by semicolon:".implode(";",$arr)."<br>";
echo "<br> Join array element by comma:".implode(";",$arr)."<br>";



Leave a Reply

Your email address will not be published. Required fields are marked *