note 32842 modified in function.fgetcsv by aidan

From: Date: Thu, 01 Jul 2004 01:03:58 +0000
Subject: note 32842 modified in function.fgetcsv by aidan
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-72213@lists.php.net to get a copy of this message
Here is a function to read a whole csv file into an array: <?php function get_csv($filename, $delim=',') { $row = 0; $dump = array(); $f = fopen ($filename,"r"); $size = filesize($filename)+1; while ($data = fgetcsv($f, $size, $delim)) { $dump[$row] = $data; $row++; } fclose ($f); return $dump; } ?> --was-- Here is a function to read a whole csv file into an array: ---------------------------------------------------------- function get_csv($filename, $delim=',') { $row = 0; $dump = array(); $f = fopen ($filename,"r"); $size = filesize($filename)+1; while ($data = fgetcsv($f, $size, $delim)) { $dump[$row] = $data; $row++; } fclose ($f); return $dump; } http://php.net/manual/en/function.fgetcsv.php

« previous php.notes (#72213) next »