Wednesday, October 15, 2008

How to join array elements together using php - implode()

Lets see how we can join elements in a array to a comma separated String (You can use any separator you want with implode().)
simply use implode and you are done


$array_items = array('item1', 'item2', 'item3');
$string_with_comma = implode(",", $array_items);

echo $string_with_comma; // item1,item2,item13


Get Free Sinhala IT Learning Videos

 Subscribe To My Blog

No comments:

Post a Comment