Forum Moderators: coopster
Iam trying to split words using explode..But for my script last word is not outputing properely.
Example :
Input :singers from db = Venu Madhav, Rajeev Kanakala, Nazar, [comma at last this by default. I need that.]
<?
$names=$row_rscast['singers'];
$names = explode(", ", $names);
$nameSize=sizeof($names);
for($i=0;$i<$nameSize;$i++){
echo "<a href='".$names[$i]."'>".$names[$i]."</a>";
if($i<($nameSize-2)){
echo ", ";
}
}
?>
Output for this script: Venu Madhav, Rajeev KanakalaNazar
This is wrong i need output like
output Needed for me: Venu Madhav, Rajeev Kanakala, Nazar
I couldnt fix it.I hope you guys help me.