Answered by : kasmin
//Remove the last character using substr
$string = substr($string, 0, -1);
Source : | Last Update : Thu, 09 Apr 20
Answered by : code-grepper
$hell = substr('hello', 0, -1);
Source : | Last Update : Mon, 11 Nov 19
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 : manoj-kumar
$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
Source : | Last Update : Tue, 09 Feb 21
Answered by : maniruzzaman-akash
echo substr($string, 0, -2);
Source : | Last Update : Tue, 06 Jul 21
Answered by : moin-ahmed
$newarraynama = rtrim($arraynama, ", ");
Source : https://stackoverflow.com/questions/5592994/remove-the-last-character-from-a-string | Last Update : Sat, 01 May 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 : rohit-ghodadra
$str = removeLast3char($str);
function removeLast3char($string){ return trim(substr($string, 0, -3));
}
Source : | Last Update : Wed, 23 Mar 22