php hapus karakter terakhir dalam 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
?>
$hell = substr('hello', 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