I need to remove specific characters at the end of a string. But if the string of characters are not there at the end, whatever is there should be left alone.
$str = "<p>this is a test</p><p>and this is another</p>";
and I need to remove the last </p> (but leave the others intact).
$trimmed = rtrim(get_the_content(),"</p>");
but it stripped out all the "</p>"'s not just the last.