Small script to process CSV files easily.
Running this code:
<?php
require('class.csv.php');
header('Content-type: text/plain');
$csv = new CSV('test.csv');
while ($row = $csv->read()) {
print_r($row);
}
on this file, you would get the following output:
Array
(
[Letter 1] => a
[Letter 2] => b
[Number 1] => 1
[Number 2] => 2
[Cost] => 3,000
[Letter 3] => c
)
Array
(
[Letter 1] => b
[Letter 2] => d
[Number 1] => 2
[Number 2] => 4
[Cost] => 6,000
[Letter 3] => f
)
Array
(
[Letter 1] => d
[Letter 2] => h
[Number 1] => 4
[Number 2] => 8
[Cost] => 12,000
[Letter 3] => l
)
Downlaod the script here. (1.2Kb)