PHP implode() Function

PHP implode() Function is used to join array elements into string.

Syntax :


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

Parameter Values,

PHP implode() 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 implode() Function in details.

Example :

$arr = array('Learn','php','implode','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 *