Hello,

This is a reply to an e-mail that you wrote on Fri, 11 Jul 2003 at 20:37,
lines prefixed by '>' were originally written by you.
> Any ideas on how I can print the lines of my file in reverse order,
> then?

How about...

$fp = fopen("yourfile.txt","r");
$filecontents = "";
while(!feof($fp)){
    $filecontents.=fgets($fp,1024); // read entire file into
$filecontents
}

$filelines = split("\n",$filecontents); // split file into individual
lines

for($i=(count($filelines)-1);$i>=0;$i--){ // loop through array in
reverse order
    echo $filelines[$i] . "\n";
}

--
phpmachine :: The quick and easy to use service providing you with
professionally developed PHP scripts :: http://www.phpmachine.com/

          Professional Web Development by David Nicholson
                    http://www.djnicholson.com/

    QuizSender.com - How well do your friends actually know you?
                     http://www.quizsender.com/
                    (developed entirely in PHP)

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to