You could do it like this:

<?
$aTextFileArray = file("your_file.txt");
$firstLineToPrint = 5;
$lastLineToPrint = 10;

for ($i = $firstLineToPrint; $i < count($aTextFileArray) || $i <
$lastLineToPrint; $i++)
{
        print "Line $i: ".$aTextFileArray[$i]."<br>";
};
?>

Niklas


-----Original Message-----
From: John Gurley [mailto:[EMAIL PROTECTED]] 
Sent: 31. tammikuuta 2002 15:32
To: [EMAIL PROTECTED]
Subject: [PHP] using eregi


Hello,
Just wondering if there is a way to print out parts of a text file (i.e
from 
line x to line y) using php, the way it is being done now is using eregi
and 
comparing strings, but it would be alot better if I could specify which 
lines to print.
Thanks a million.



_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED] To
contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to