Results 1 to 3 of 3

Thread: Reading text files,[resolved]

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Dec 2003
    Posts
    4,787

    Reading text files,[resolved]

    How do you read ceratin lines of a text file with php?
    Last edited by Pino; Aug 8th, 2004 at 03:53 AM.

  2. #2
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    If you want a certain line, the best way (IMO) is:

    Code:
    $fileContents = file('filename.txt');
    
    echo $fileContents[1]; // will echo the second line
    My evil laugh has a squeak in it.

    kristopherwilson.com

  3. #3

    Thread Starter
    PowerPoster
    Join Date
    Dec 2003
    Posts
    4,787
    its that simple? wow i've been loading the whole file into a string then loopin through splitting it up but it was just getting confusing

    thanks i'll give it a hot tonight

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width