Friday, February 18, 2011

How-to-join-text-in-PHP script (part 2)

Assalamu'alaikum and selamat sejahtera

Okey....we already learn the joining thing in last post ryte...if you did not remember,just click here.but in this post,we will do on array..here is the example:


$group = array("Alpha", "Beta", "Charlie", "Delta");


and then we join it using implode():


$group=implode(",", $group);


the concept is same with explode()  that is,it need two thing: the separator and the variable name(but in array).
then we print it:

print $group;

the code:

<?PHP
$group = array("Alpha", "Beta", "Charlie", "Delta");

$group=implode(",", $group);
 print $group;
?>


try this!

$group=implode("-", $group);

Or

$group=implode("#", $group);
 
Or

$group=implode(" ", $group);

N/NOTE:any question guys?

No comments:

Post a Comment