yeah, give that a shot. Obviously, certain characters need to be escaped for a reason. If not, php gets confused. For example
$var = "hello "bob", how are you";
PHP gets confused w/all the quotes and produces a parse error. The variable would need to have the quotes escaped
$var = "hello \"bob\", how are you";
If you strip the slashes before writing, it should work without any error messages, however I'm not positive. Give it a try and see what happens (but as far as the use of the function, you've got it down right).
Cgraz