Connecting Tech Pros Worldwide Forums | Help | Site Map

fopen() in reverse

KoRnDragon
Guest
 
Posts: n/a
#1: May 10 '06
I'm remaking my old FFA (Free For All) script and I've got just about
everything done except for the reverse entries for the textfile.

I need to have all the entried ordered from newest to oldest.

Thanks in advance.


Henrik Hansen
Guest
 
Posts: n/a
#2: May 10 '06

re: fopen() in reverse


"KoRnDragon" <korndragon@gmail.com> writes:
[color=blue]
> I'm remaking my old FFA (Free For All) script and I've got just about
> everything done except for the reverse entries for the textfile.
>
> I need to have all the entried ordered from newest to oldest.[/color]

use file() and array_reverse() ?

--
Henrik Hansen
Andy Jeffries
Guest
 
Posts: n/a
#3: May 10 '06

re: fopen() in reverse


On Wed, 10 May 2006 11:51:54 +0200, Henrik Hansen wrote:[color=blue][color=green]
>> I'm remaking my old FFA (Free For All) script and I've got just about
>> everything done except for the reverse entries for the textfile.
>>
>> I need to have all the entried ordered from newest to oldest.[/color]
>
> use file() and array_reverse() ?[/color]

Or if your file is large (because file will obviously load the whole file
in to an array), use exec or something similar to use the
Linux command line utility "rev".

Cheers,


Andy

--
Andy Jeffries MBCS CITP ZCE | gPHPEdit Lead Developer
http://www.gphpedit.org | PHP editor for Gnome 2
http://www.andyjeffries.co.uk | Personal site and photos

KoRnDragon
Guest
 
Posts: n/a
#4: May 12 '06

re: fopen() in reverse


I may use array_reverse() but how long do you think it would take to
start showing a noticeable difference in load time? About how many
lines/entries?

Henrik Hansen
Guest
 
Posts: n/a
#5: May 13 '06

re: fopen() in reverse


"KoRnDragon" <korndragon@gmail.com> writes:
[color=blue]
> I may use array_reverse() but how long do you think it would take to
> start showing a noticeable difference in load time? About how many
> lines/entries?[/color]

Try it out? Create a file with a lot of lines and time the
loadtime. Depends on the lengts of the lines too..


--
Henrik Hansen
Closed Thread