I have a text file like this
2018-10-09 1
2018-11-12 1
2018-11-13 7
2018-11-15 1
2018-11-18 7
I loop the file to display the result like this
<?php
$offers = file('logs/offer.txt');
foreach($offers as $line) {
$lineArray = explode("\t", $line);
list($date, $quantity) = $lineArray;
echo '<tr>
<td>' . $date . '</td>
<td>' .$quantity. '</td>
</tr>';
}
?>
I get the result but I want to start from the end of the file and echo the result like this (start with latest date)
2018-11-18 7
2018-11-15 1
2018-11-13 7
2018-11-12 1
2018-10-09 1