The Objective
To read the csv file, and separate each line into an array. The first line (field names) displayed once, and then loop through the remaining data.
I have this function to open and explode the csv file
$myFile = "csv.csv";
$fh = fopen($myFile, 'r');
$theData = fread($fh, filesize($myFile));
fclose($fh);
$csv = explode(",", $theData);
This is the CSV file in question
id,sub,type,regprice,natprice
1,4,Team,40,75
2,4,Individual,15,35
3,4,Stunt Group,50,150
4,4,Coed Partner Stunt,50,150
What i need to know how to do, is load the first line into an array separately, then loop through the remaining arrays in the following manner.
Array[0][0] - Array[0][1] - Array[0][2] - Array[0][3] - Array[0][4]
-------------------------------------------------------------------
Array[1][0] - Array[1][1] - Array[1][2] - Array[1][3] - Array[1][4]
Array[2][0] - Array[2][1] - Array[2][2] - Array[2][3] - Array[2][4]
Array[3][0] - Array[3][1] - Array[3][2] - Array[3][3] - Array[3][4]
Array[4][0] - Array[4][1] - Array[4][2] - Array[4][3] - Array[4][4]