Easy Tutorial
❮ Func Date Timestamp Get Func Array Count ❯

PHP implode() Function

PHP String Reference Manual

Example

Combine array elements into a string:


Definition and Usage

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

Note: The implode() function accepts two parameter orders. However, due to historical reasons, explode() does not allow this; you must ensure that the separator parameter comes before the string parameter.

Note: The separator parameter in the implode() function is optional. But for backward compatibility, it is recommended to use both parameters.

Note: This function is binary-safe.


Syntax

Parameter Description
separator Optional. Specifies what to put between the array elements. Default is "" (an empty string).
array Required. The array to join into a string.

Technical Details

Return Value: Returns a string from the elements of an array.
PHP Version: 4+
--- ---
Changelog: The separator parameter became optional in PHP 4.3.0.
--- ---

More Examples

Example 1

Separate array elements with different characters:


❮ Func Date Timestamp Get Func Array Count ❯