Hi!
I need to read a file (line-by-line) in reverse order, without reading the
whole file into memory first.
Is there an easy way of doing this? As in, is there a PHP function I could
use?
The solution has to be platform independent, so "popen("tac $filename")...
wouldn't work.
Example input and ouput:
<myfile.txt input>
line 1
line 2
line 3
</myfile.txt input>
<output from php script>
line 3
line 2
line 1
</output from php script>
All the best,
Erik
--
Erik Andersson ( AussieTraders.c om.au )
- Placing an add is FREE at AussieTraders.c om.au, Australia's buy & sell
marketplace
I need to read a file (line-by-line) in reverse order, without reading the
whole file into memory first.
Is there an easy way of doing this? As in, is there a PHP function I could
use?
The solution has to be platform independent, so "popen("tac $filename")...
wouldn't work.
Example input and ouput:
<myfile.txt input>
line 1
line 2
line 3
</myfile.txt input>
<output from php script>
line 3
line 2
line 1
</output from php script>
All the best,
Erik
--
Erik Andersson ( AussieTraders.c om.au )
- Placing an add is FREE at AussieTraders.c om.au, Australia's buy & sell
marketplace
Comment