Showing posts with label join array elements. Show all posts
Showing posts with label join array elements. Show all posts

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


<?php

$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 Kuppiya.com

 Subscribe To My Blog