PHP supprime le dernier caractère en chaîne
//Remove the last character using substr
$string = substr($string, 0, -1);
Kasmin Nicko
//Remove the last character using substr
$string = substr($string, 0, -1);
$string = rtrim($string, ',');
echo substr($string, 0, -3);
$arrStr = 'Str1, Str2, str3, ';
echo rtrim($arrStr, ", "); //Str1, Str2, str3
echo substr_replace($arrStr, "", -2); //Str1, Str2, str3
echo substr($arrStr, 0, -2); // Str1, Str2, str3
echo substr($string, 0, -3);
$str = removeLast3char($str);
function removeLast3char($string){
return trim(substr($string, 0, -3));
}