Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

implode

Description

The implode of String for PHP join array elements with a string.

Syntax

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

Parameters

glue

Defaults to an empty string.

pieces

The array of strings to implode.

Return

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

Examples

1 · pieces

<?

$pieces = array('1', '2', '3');

$return = implode($pieces);

var_export($return);

?>
'123'

2 · glue pieces

<?

$glue = ',';
$pieces = array('1', '2', '3');

$return = implode($glue, $pieces);

var_export($return);

?>
'1,2,3'

3 · Empty

<?

$glue = ',';
$pieces = array();

$return = implode($glue, $pieces);

var_export($return);

?>
''
HomeMenu