php remove last character from string if comma
snippet in php

php remove last character from string if comma

user3107

$string = rtrim($string, ',');