How to convert array to string in php?

$array = array(‘cakephp’,‘zend’);
$string =implode(’ and ',$array);
echo $string;

Hi Ann
Did you have a question about this?

yeah i have. sorry Quetion is … How to convert array to string in php?

The code you posted should echo the array as:-

cakephp and zend

Is that what you wanted, or something else, or is there a problem with using that code?

i was asking code is written right or not??

It looks OK, give it a try and see if it works.

If the list isn’t long and is only those two, you can try

print($array[0] . ' and ' . $array[1]);

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.