RE: [PHP] Files question
From: Ray Hunter (bigdog_at_venticon.com)
Date: 10/30/03
- Next message: Sylvain Donnet: "input handler ?"
- Previous message: Manuel VáZquez Acosta: "Re: Files question"
- In reply to: Jay Blanchard: "RE: [PHP] Files question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
To: php-general@lists.php.net Date: Thu, 30 Oct 2003 07:56:48 -0700
> Well, Bas, the fopen and it's associated manual pages describe just how
> to do this. Basic example
>
> $theFile = fopen("myfile.foo", "r"); //open the file for reading
> while(!feof($theFile)){ // while the file is not at the end of the file
> $theLine = fgets($theFile, 1024); // get a line, specify a
> length
> echo $theLine; // print out the line you just got
> } //close the while loop
http://us2.php.net/manual/en/function.file.php
Using file will read each line of a file into an element of the returned
array. then you can loop through the array and pull out line by
line...example:
$lines = file( "somefile.txt" );
foreach( $lines as $line => $value ) {
echo "$line = $value<br>";
}
HTH
-- Ray
- Next message: Sylvain Donnet: "input handler ?"
- Previous message: Manuel VáZquez Acosta: "Re: Files question"
- In reply to: Jay Blanchard: "RE: [PHP] Files question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|