Saturday, April 11, 2009

PHP: Convert an array into string


Share at Facebook

You can convert a array into a string using implode() function. This function takes the joining delimiter for the array, and the array itself, and return the string.

$array = array(1,2,3,4,5,6,7);
$string = implode('', $array);
print "$string\n


You can change this into any delimiter. I mean you can pass any string, for example tab, comma, dot as glue/delimiter inside implode() function




No comments: