I want to remove the comma off the end of a string. As it is now i am using
$string = substr($string,0,-1);
but that only removes the last
$string = rtrim($string, ',');
Docs for rtrim here