PHP implode() Function

Last Updated:

PHP implode()

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

Note: This function accept its parameters in either order. For consistency with explode(), however, it is deprecated not to use the documented order of arguments.

Note: This function is binary-safe.

Example

PHP Compiler
<?php $arr = array('apple', 'banana', 'orange'); echo implode("s, ", $arr); ?>

Syntax

implode(str, arr)

Parameter Values

ValueTypeExplanation
str Optional Specifies a string to prepend to each element in an array.
Default value is an empty string.
arr Required Specifies an array.

Return Value

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

Share this Page

Meet the Author