PHP implode() function

The implode() function join array elements with a string.


implode ( string $separator , array $array_name ) : string


Parameter Name Descrption
separator Optional, Defaults to an empty string(""), specify the separator between the array elements
array_name Required, array for join to string

Return Value

Returns the string of array elements with containing separator

PHP implode() examples

$lang = array('PHP','Java','Python');
echo implode('',$lang);
//Output:: PHPJavaPython 

echo implode('-',$lang);
//Output:: PHP-Java-Python

Related Functions