addcslashes() may be your best bet...I have a feeling the format is as follows (just my best guesses from looking at the http://us4.php.net/manual/en/function.addcslashes.php documentation of the function):
It needs to be a string, and your best bet is to use double quotes, because double quotes seem to recognize more escape sequences in PHP than single quotes. To specify a range, use something like a...z where is the first character and z is the last character in the range. For instance, "a...z" will escape any characters with ASCII values between "a" (91 i think?) and "z" (26 higher). I forget if my numbers are off a bit, but you get the idea.
Put @ between different ranges or characters to indicate that those two ranges should be combined. For instance, "a..z@A...Z" would escape all upper and lower case letters.
The backslashes that you see in the documentation aren't part of the function-specific syntax, but rather for the php parser so that you can type \37 and mean the ascii character with 31 as its code (37 is octal for 31). So ultimately, "\0..\37!@@\177..\377" will mean escape all characters from 0 to 31 and 127 to 255, but not an actual backslash itself ("!@\").
Whether or not this helps you I don't know, but it would seem that then "stripslashes" and "stripcslashes" would work for converting the "slashed" string back to its normal form. Try setting up a sample script that lets you type in some text, submit it then returns the text both after being escaped and reverted - eventually you should find something that works, I'd think. Good luck!