Replacing the last character of a String in PHP can be done using the substr_replace() function.
For example, if the String is "uhded-" and you want to get rid of the last character. You can do substr_replace("uhded-","",-1);
$str = "uhded-"; echo substr_replace($str,"",-1); //returns "uhded"
The way it works is that when you specify the third parameter with a -1, it starts replacing from the back of the String.
I hope this helps.