note 103280 added to function.fgetcsv

From: Date: Tue, 05 Apr 2011 15:20:39 +0000
Subject: note 103280 added to function.fgetcsv
Groups: php.notes 
Request: Send a blank email to php-notes+get-178520@lists.php.net to get a copy of this message
fgetcsv() appears to have an undocumented 5th parameter, which allows to specify an escape character. It defaults to the backslash (\), which is actually incorrect for standard CSV. Example: $row = fgetcsv($fp, 4096, ',', '"', "\x00"); This allows to correctly read standard CSV files - as long as they don't contain \x00 (AFAIR, MS Access produces CSV files where NULL values are represented by \x00). It appears that it's impossible to fully disable the escape character, it's only possible to redefine it. Checked with PHP 5.3.5. ---- Server IP: 217.160.235.204 Probable Submitter: 62.156.253.205 ---- Manual Page -- http://www.php.net/manual/en/function.fgetcsv.php Edit -- https://master.php.net/note/edit/103280 Del: integrated -- https://master.php.net/note/delete/103280/integrated Del: useless -- https://master.php.net/note/delete/103280/useless Del: bad code -- https://master.php.net/note/delete/103280/bad+code Del: spam -- https://master.php.net/note/delete/103280/spam Del: non-english -- https://master.php.net/note/delete/103280/non-english Del: in docs -- https://master.php.net/note/delete/103280/in+docs Del: other reasons-- https://master.php.net/note/delete/103280 Reject -- https://master.php.net/note/reject/103280 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#178520) next »