remover a última letra php
<?php
echo substr('abcdef',0, -1); // abcde
?>
php remover o último carácter do texto
$hell = substr('hello', 0, -1);
subestr do php remover os últimos 4 caracteres
echo substr($string, 0, -3);
remover o último carácter do texto em php
$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
php remover o último caracteres do texto
//Remove the last character using substr
$string = substr($string, 0, -1);
php remover o último carácter do texto se vírgula
$string = rtrim($string, ',');