SYNOPSIS

string implode( mixed *arr, string del)

DESCRIPTION

Concatenate all strings found in array arr, with the string del between each element. Only strings are used from the array.

USAGE

This basic example inserts an asterisk between each array element:

implode(({ "foo", "bar", "" }), "*") // returns "foo*bar*"

Because implode ignores non-string elements, the result below only includes a single “b”:

implode(({ "a", 2, this_object(), "c" }), "b") // returns "abc"

Together with explode(E) this can be used as a search-and-replace for strings:

implode(explode("a short text", " "), "_") // returns "a_short_text"

But nowadays you can also use:

regreplace("a short text", " ", "_", 1)