php remove character if last is code example
Example 1: php remove last character from string
$hell = substr('hello', 0, -1);
Example 2: php remove last character from string if comma
$string = rtrim($string, ',');
$hell = substr('hello', 0, -1);
$string = rtrim($string, ',');