hrm, works for me.
Code:
[joe@portia test]$ php -q
<?
$f = fopen("blah.txt", "w");
$s = "this is a \"quoted\" string\n";
fwrite($f, $s);
fclose($f);
?>
[joe@portia test]$
[joe@portia test]$ cat blah.txt
this is a "quoted" string
[joe@portia test]$ can you provide a real code example that doesn't work?