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().

Advertisements

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

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: