PHP Remova o último caractere em string
//Remove the last character using substr
$string = substr($string, 0, -1);
Kasmin Nicko
//Remove the last character using substr
$string = substr($string, 0, -1);
<?php
echo substr('abcdef',0, -1); // abcde
?>
$string = rtrim($string, ',');
echo substr($string, 0, -3);
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