note 85799 added to function.str-getcsv

From: Date: Thu, 18 Sep 2008 10:19:26 +0000
Subject: note 85799 added to function.str-getcsv
Groups: php.notes 
Request: Send a blank email to php-notes+get-144506@lists.php.net to get a copy of this message
If your happy enough having just a multi-dimensional array, this should work fine. I had wanted to use the one provided by keananda but it was choking on pr($lines). <?php function f_parse_csv($file, $longest, $delimiter) { $mdarray = array(); $file = fopen($file, "r"); while ($line = fgetcsv($file, $longest, $delimiter)) { array_push($mdarray, $line); } fclose($file); return $mdarray; } ?> $longest is a number that represents the longest line in the csv file as required by fgetcsv(). The page for fgetcsv() said that the longest line could be set to 0 or left out, but I couldn't get it to work without. I just made it extra large when I had to use it. ---- Server IP: 208.69.120.35 Probable Submitter: 24.144.169.51 ---- Manual Page -- http://www.php.net/manual/en/function.str-getcsv.php Edit -- https://master.php.net/note/edit/85799 Del: integrated -- https://master.php.net/note/delete/85799/integrated Del: useless -- https://master.php.net/note/delete/85799/useless Del: bad code -- https://master.php.net/note/delete/85799/bad+code Del: spam -- https://master.php.net/note/delete/85799/spam Del: non-english -- https://master.php.net/note/delete/85799/non-english Del: in docs -- https://master.php.net/note/delete/85799/in+docs Del: other reasons-- https://master.php.net/note/delete/85799 Reject -- https://master.php.net/note/reject/85799 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#144506) next »