Skip to content

Instantly share code, notes, and snippets.

Created Sep 26, 2015

What would you like to do?
function csvPutEnclosed($file, $entries) {
$fp = fopen($file, 'a+');
foreach($entries as $entry) {
fputcsv($fp, array_map(function($v) { return "\"".str_replace('"', '\"', $v)."\"";}, $entry), ',', chr(0));
file_put_contents($file, str_replace(chr(0), '', file_get_contents($file)));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.