Showing posts with label Array to String in PHP. Show all posts
Showing posts with label Array to String in PHP. Show all posts

Monday, September 29, 2008

The implode() function

The implode function is used to glue together elements of an array into a string.

Syntax: implode([separator, ]array);

separator - this parameter specifies the character or characters to be put between the array elements when they are glued together into a string. The default value is an empty space.

array – the input array

Example input:

$employee = array('This', 'is','John.');
echo implode(" ",$employee);

Example output:

This is John.