note 102763 deleted from function.str-getcsv by danbrown
| From: | danbrown@php.net | Date: | Fri, 04 Mar 2011 14:50:21 +0000 |
| Subject: | note 102763 deleted from function.str-getcsv by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-177559@lists.php.net to get a copy of this message | ||
Note Submitter: depely AT IAMNOTABOT prestaconcept.net
----
The previous anonymous function only read the first line:
<?php if (!function_exists('str_getcsv')) {
function str_getcsv($input, $delimiter=',', $enclosure='"', $escape=null,
$eol=null) {
$temp=fopen("php://memory", "rw");
fwrite($temp, $input);
fseek($temp, 0);
$r = array();
while (($data = fgetcsv($temp, 4096, $delimiter, $enclosure)) !== false) {
$r[] = $data;
}
fclose($temp);
return $r;
}
} ?>