Dibawah ini adalah contoh script php untuk menghilangkan koma awal dan ahir.
<?php
$text =”,1,2,3,4,5,”;
$te = explode(”,”,$text);
if (is_array($te))
{
foreach ($te as $v)
{
if ($v!=”"){
$val[]=$v;
}
}
$te = implode(”,”,$val);
}else{
$te = “”;
}
echo $te;
?>
Hasil : 1,2,3,4,5



0 Responses
Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.