PHP » Strings » implode()

Syntax:
string implode(string separator, array pieces)
separator
Sequence of characters to separate the string pieces with.
pieces
The string pieces to put together.

Makes a string of an array.

This function is the reverse of explode() and creates a string where each element of the array is separated with the separator.

Examples

Code:
<?php

$array1 = array("apple", "banana", "pear");

print implode(", ", $array1);

?>
Output:
apple, banana, pear
Explanation:

An array is converted to a comma separated string.

See Also: