I have this array called $csv, it contains cars that have year, make and model.
function readCSV($csvFile){
$file_handle = fopen($csvFile, 'r');
while (!feof($file_handle) ) {
$line_of_text[] = fgetcsv($file_handle, 1024);
}
fclose($file_handle);
return $line_of_text;
}
// Set path to CSV file
$csvFile = 'csv/file.csv';
$csv = readCSV($csvFile);
array_shift($csv);
foreach($csv as $car){
$year = $car[3];
$make = $car[4];
$model = $car[5];
echo $year;
}
This gives me - 2011 2009 2012 2012 2013
How would I filter the results to display in order by newest to oldest?