- fputcsv: documentation ( source)
- fgetcsv: documentation ( source)
- var_export: documentation ( source)
- json_encode: documentation ( source)
- fclose: documentation ( source)
- rewind: documentation ( source)
- fopen: documentation ( source)
<?php
$row_before = ['A', json_encode(['a', '\\', 'b']), 'B'];
print "\nBEFORE:\n";
var_export($row_before);
print "\n";
$fh = fopen($file = 'php://temp', 'rb+');
fputcsv($fh, $row_before, ',', '"', "\0");
rewind($fh);
$row_after = fgetcsv($fh);
print "\nAFTER:\n";
var_export($row_after);
print "\n\n";
fclose($fh);