php fgets()
| From: | arnaud gonzales | Date: | Wed, 15 May 2002 00:20:29 +0000 |
| Subject: | php fgets() | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-97640@lists.php.net to get a copy of this message | ||
Hi,
I'm newbie in php and i would like to clearly understand how can i use:
LENGTH in string fgets ( int fp [, int length])
"Returns a string of up to length - 1 bytes read from the file pointed to by
fp. Reading ends when length - 1 bytes have been read, on a newline (which
is included in the return value), or on EOF (whichever comes first). If no
length is specified, the length defaults to 1k, or 1024 bytes."
-Can i have an example of the differents way for reading file with fgets
according to the differentes values of "length "?
-why '4096' is used as length for reading a file line by line ?
$fd = fopen ("/tmp/inputfile.txt", "r");
while (!feof ($fd)) {
$buffer = fgets($fd, 4096);
echo $buffer;
}
fclose ($fd);
Is this any max for one line??
TIA.
arnaud G.