The implode() function does the exact opposite of explode()—it creates a large string from an array of smaller strings
$string = implode(separator, array);
The first argument, separator, is the string to put between the elements of the second argument, array. To reconstruct the simple comma-separated value string, simply say
$fields = array(‘Fred’, ’25’, ‘Wilma’);
$string = implode(‘,’, $fields); // $string is ‘Fred,25,Wilma’
More Example of implode in php
<?php
$array = array('lastname', 'email', 'phone');
$comma_separated = implode(",", $array);
echo $comma_separated; // lastname,email,phone
// Empty string when using an empty array:
var_dump(implode('hello', array())); // string(0) ""
?>