Answered by : indian-gooner
rtrim($my_string, ',');
Source : https://stackoverflow.com/questions/15408691/how-do-i-remove-the-last-comma-from-a-string-using-php | Last Update : Thu, 19 Nov 20
Answered by : code-grepper
$hell = substr('hello', 0, -1);
Source : | Last Update : Mon, 11 Nov 19
Answered by : yeasin-arafat-783pljfpna57
$animels = array("Dog", "Cat", "Tiger", "Lion", "Cow");
$count_animel = count($animels);
$set_count = 0;
foreach ($animels as $animel) { echo $animel; $set_count = $set_count + 1; if ($set_count < $count_animel) { echo ", "; }
}
Source : | Last Update : Sat, 27 Aug 22
Answered by : geeky-bravo
$string = rtrim($string, ',');
Source : https://stackoverflow.com/questions/1642698/how-do-i-remove-a-comma-off-the-end-of-a-string | Last Update : Wed, 01 Jul 20
Answered by : helpful-hippopotamus-7rhwx737yf34
echo substr($string, 0, -3);
Source : https://stackoverflow.com/questions/4915753/how-can-i-remove-3-characters-at-the-end-of-a-string-in-php | Last Update : Sat, 31 Oct 20
Answered by : jolly-jackal-m3gw0ryu4wc3
echo substr($string, 0, -3);
Source : | Last Update : Thu, 08 Oct 20
Answered by : maniruzzaman-akash
echo substr($string, 0, -2);
Source : | Last Update : Tue, 06 Jul 21
Answered by : tough-teira-jbi7oxbw9kdg
$newarraynama = rtrim($arraynama, ", ");
Source : https://stackoverflow.com/questions/5592994/remove-the-last-character-from-a-string | Last Update : Thu, 30 Sep 21
Answered by : muhammad-waseem
//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;
}
Source : https://stackoverflow.com/questions/19935405/removing-last-comma-from-a-foreach-loop | Last Update : Wed, 24 Nov 21
Answered by : faheem-mehdi
$p_country= rtrim($p_countrys, ',')
Source : | Last Update : Sat, 27 Aug 22