how to read or display the txt file from the bottom in php -


i want display txt file contents bottom display oldest posts.

     $file = file("./files/data.txt");         for($i =0;$i<count($file);$i++){            print nl2br($file[$i]);         } 

this simple code display text contents top bottom,but want contents displayed bottom top. glad if can me out.

change

$file = file("./files/data.txt"); 

to

$file = array_reverse(file("./files/data.txt")); //<----- reverse array using array_reverse 

no need modifications on loop , if above change.

source


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -