note 42316 added to function.tidy-parse-file
| From: | woodie at worldpac dot com | Date: | Wed, 12 May 2004 00:42:31 +0000 |
| Subject: | note 42316 added to function.tidy-parse-file | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-69497@lists.php.net to get a copy of this message | ||
I could not find a csv parser, so here is one I created:
$file = file('data.csv');
$cols = explode(",",rtrim(array_shift($file))); // get column headings
array_shift($cols); // delete first (describes nodes)
foreach($file as $row) {
$vals = explode(",",rtrim($row));
$node = array_shift($vals); // first col is node name
foreach($vals as $key => $val) {
$data[$node][$cols[$key]] = $val;
}
}
----
Manual Page -- http://www.php.net/manual/en/function.tidy-parse-file.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+42316
Delete -- http://master.php.net/manage/user-notes.php?action=delete+42316&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+42316&report=yes
Search -- http://master.php.net/manage/user-notes.php