in reply to Formatting quotes in a String
If I understand your question...
substr($my_string, -1, 1) = "'\"";