If you are able to use other PHP db2 functions, it is possible that that one does not exist yet in the version you are using (or at all.) PHP 5.2.3 is out, but I doubt one of the things changed was to add that function.
If using a \ meets the db2 escape character requirements, you can use the PHP addcslashes() function. If two single quotes are needed, you would need to use something like the str_replace() function.
I used both addslashes() and str_replace! str_replace has the effect that single quotes become double quotes or two single quotes in succession. addslashes() has no effect. But thanks for your help! I will keep on searching and trying! If you have other ideas please feel free.