Well, it seems strange that no one has asked this question before and it has been bothering me for hours but here's what I am trying to do.
I need to reverse the order of a text file, show the last 10 entries and print the contents but not from the last entry showing first. Rather I wish to maintain the order. ie. the first entry should show first and the last entry should show last.
I already have the PHP code to reverse and show the last 10 entries which I posted below with the help of a user. Thanks a ton for your help in advance!
Code
<?php $text = file('user.txt');
$text= array_reverse($text);
$counter=0;
while ($counter < 10) {
if (isset($text[$counter])) {
echo $text[$counter] . "";
}
$counter++;
}
?>