I'm using rtrim()
to remove a part at the end of string, , US
in my example:
<?php
$str = "Hello - world, c., US, US";
echo rtrim($str,", US");
?>
Output:
Hello - world, c.
It removed , US, US
and i want to remove the last one only and the output should be Hello - world, c., US
How i can do that please?