I would like to echo data of rows from a CSV file in the order I assign.
With the code below all data is echoed properly, but the order of the data is ascending (first row 12, followed by rows 16, 24).
Is there any way to echo the data on the page in the order I prefer (row 16, row 24, row 12) ?
Code: Select all
<?php
$row = 0;
while (($data = fgetcsv($handle, 10000, " ")) !== FALSE) {
$num = count($data);
$row++;
if ($row == 16 || $row == 24 ||$row==12)
{
echo "<p>" . $data[11] . $data[4] . $data[3] . "</p>";
}
}
fclose($handle);
?>