I am not sure if this is what you want. Can you add an extra single quote to the existing single quote first:
$text= str_replace("'", "''", $text);
then do addsplash to get rid of double quote and single quote, and you still have one single quote left.