|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
You eat, breathe and sleep innovation. Build your mobile intelligence with BlackBerry® experts this July. Register Today! |
|
#1
|
|||
|
|||
|
Displaying text from bottom up
How do I display a text file backward from the last line to line 1. i am trying to display latest results on top.
thanks |
|
#2
|
|||
|
|||
|
RE: Displaying text from bottom up
Ahaha, I remember doing a function for a CS test last year:
It was a recursive function, so it would input a line, save it to a variable and then recurse; it would then echo the line out. To grab a line in PHP, use $temp = fgets($fp); //open $fp using fopen However, I would probably just grab all lines as an array. Fastest way: http://www.php.net/manual/en/function.file.php |
|
#3
|
||||
|
||||
|
RE: Displaying text from bottom up
Interesting that you posted this at two different forums! or is it that I only found it at 2?
|
|
#4
|
|||
|
|||
|
RE: Displaying text from bottom up
lol, i found this post at phpfreaks.com aswell..no harm though, just like buying a lotto ticket with more numbers
|
|
#5
|
|||
|
|||
|
RE: Displaying text from bottom up
even using "file" you'd still need the array_reverse function i think. considering it's stored from top to bottom by default.
|
|
#6
|
|||
|
|||
|
RE: Displaying text from bottom up
|
![]() |
| Viewing: Codewalkers Forums > PHP Related > PHP Coding > Displaying text from bottom up |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|