Converting an array to a string is a pretty frequent task when programming. Whether you want to join some sentences into a paragraph or just smash the values into some sort of hash, you can do so very simply with PHP’s implode function.

Implode takes 1 to 2 arguments. In it’s simplest form, you can pass it your array and the values will be joined by an empty string. The other option is to pass in the “glue” as the first argument which is the string that will be used to stick the array elements together. The glue is followed by the array:

$array = [

echo implode($array) // ABCDEFGHIJ...

echo implode('::', $array); // ABCDEFG::HIJ...