fopen() in reverse

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • KoRnDragon

    #1

    fopen() in reverse

    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

    #2
    Re: fopen() in reverse

    "KoRnDragon " <korndragon@gma il.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

    Comment

    • Andy Jeffries

      #3
      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

      Comment

      • KoRnDragon

        #4
        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?

        Comment

        • Henrik Hansen

          #5
          Re: fopen() in reverse

          "KoRnDragon " <korndragon@gma il.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

          Comment

          Working...