note 47547 deleted from function.fputcsv by danbrown

From: Date: Thu, 20 Nov 2008 14:44:22 +0000
Subject: note 47547 deleted from function.fputcsv by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-146757@lists.php.net to get a copy of this message
Note Submitter: arthur.at.korn.ch ---- The function in the prior comment doesn't escape quotes in fields, here mine: function fputcsv($handle, $row, $fd=',', $quot='"') { $str=''; foreach ($row as $cell) { str_replace(Array($quot, "\n"), Array($quot.$quot, ''), $cell); if (strchr($cell, $fd)) { $str.=$quot.$cell.$quot.$fd.' '; } else { $str.=$cell.$fd.' '; } } fputs($handle, substr($str, 0, -2)."\n"); return $str-1; }

« previous php.notes (#146757) next »