$string = "'name', 'name2', 'name3',"; // this is the full string or text.
$string = chop($string,","); // remove the last character (,) and store the updated value in $string variable.
echo $string; // to print update string.
解决方案2:
$string = '10,20,30,'; // this is the full string or text.
$string = rtrim($string,',');
echo $string; // to print update string.
Solution 3:
$string = "'name', 'name2', 'name3',"; // this is the full string or text.
$string = substr($string , 0, -1);
echo $string;