Reading Specific Lines From TXT Files

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • KennedyR
    New Member
    • Jun 2007
    • 1

    Reading Specific Lines From TXT Files

    Basically what I want to do is just display lines 10 - 20 for example. Nothing else. Is there a way to do this?

    I can get the whole document to display with

    [PHP]$filename="text .txt";
    //open file
    $fp = fopen($filename ,'r');

    //loop through each line in the file
    while($line=fge ts($fp)) {
    //output current text file line
    print $line."<br>";
    }

    //close file handle
    fclose($fp);[/PHP]

    Does anyone have any ideas?

    Thanks in advance!
  • pbmods
    Recognized Expert Expert
    • Apr 2007
    • 5821

    #2
    Heya, KennedyR. Welcome to TSDN!

    Try using file().

    Comment

    Working...