To join Array elements into a String in PHP.

Here its the paradox of explode() function and the function name is implode().

using the function:

$str=array(‘kumar’,'gandhi’,'flexonblog’);

now i want to join the array elements into one string with’-’ as separated ,so to do this we have to write the line..

$newstr=implode(“-” ,$str);

Now if we print the string string ..

echo $newstr;

The Ouput: kumar-gandhi-flexonblog

its the reverse of the function explode().

2 Responses to “To join Array elements into a String in PHP.”

  1. Jesse Couch Says:

    this is a good tool if you want a simple way of passing arrays between a client language and php.

  2. kumargandhi Says:

    yes your correct, and for separations.

    regards,
    kumar.

Leave a Reply