Name

implode()

Synopsis

    string implode ( string separator, array pieces )

The implode() function converts an array into a string by inserting a separator between each element. This is the reverse of the explode() function. For example:

    $oz = "Lions and Tigers and Bears";
    $oz_array = explode(" and ", $oz);
    // array contains "Lions", "Tigers", "Bears"

    $exclams = implode("! ", $oz_array);
    // string contains "Lions! Tigers! Bears!"

Get PHP in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.