1
2<?php
3$row = 1;
4if (($handle = fopen("test.csv", "r")) !== FALSE) {
5 while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
6 $num = count($data);
7 echo "<p> $num fields in line $row: <br /></p>\n";
8 $row++;
9 for ($c=0; $c < $num; $c++) {
10 echo $data[$c] . "<br />\n";
11 }
12 }
13 fclose($handle);
14}
15?>
16
17
1$lines =file('CSV Address.csv');
2
3foreach($lines as $data)
4{
5list($name[],$address[],$status[])
6= explode(',',$data);
7}
8
1$csv = array_map("str_getcsv", file("data.csv", "r"));
2$header = array_shift($csv);
3// Seperate the header from data
4
5$col = array_search("Value", $header);
6 foreach ($csv as $row) {
7 $array[] = $row[$col];
8}
9