PHP implode() Function

The implode() function returns a string from the elements of an array.

The implode() function accept its parameters in either order. However, for consistency with explode(), you should use the documented order of arguments.The separator parameter of implode() is optional. However, it is recommended to always use two parameters for backwards compatibility.

string implode ( string $glue , array $pieces )
string implode ( array $pieces )

Join array elements with a glue string.

Example -

Example #1 implode() example

ParameterDescription
separatorOptional. Specifies what to put between the array elements. Default is "" (an empty string)
arrayRequired. The array to join to a string

Returns a string containing a string representation of all the array elements in the same order, with the glue string between each element.