- fputcsv: documentation ( source)
- stream_get_contents: documentation ( source)
- fclose: documentation ( source)
- rewind: documentation ( source)
- fopen: documentation ( source)
<?php
$row = ['a\\"', 'bbb'];
$fp = fopen('php://memory', 'w+');
fputcsv($fp, $row, ',', '"', "\0");
rewind($fp);
echo stream_get_contents($fp);
fclose($fp);