supprimer la dernière virgule de la chaîne php
rtrim($my_string, ',');
Indian Gooner
rtrim($my_string, ',');
$string = rtrim($string, ',');
echo substr($string, 0, -2);
//dont print last comma after string print using foreach loop
hasComma = false;
foreach ($this->sinonimo as $s){
if (hasComma){
echo ",";
}
echo '<span>'.ucfirst($s->sinonimo).'</span>';
hasComma=true;
}