fgets

fgets -- Gets line from file pointer

Description

string fgets ( int fp [, int length])

Returns a string of up to length - 1 bytes read from the file pointed to by fp .

דוגמה 1 .

 
$fd

 
=

 
fopen

 
(

 
"

 
/

 
tmp

 
/

 
inputfile.txt"

 
,

 
"r")

 
;

 
while

 
(!feof

 
($fd)

 
)

 
{

 
$buffer

 
=

 
fgets($fd

 
,

 
4096)

 
;

 
echo

 
$buffer

 
;

 
}

 
fclose

 
($fd)

 
;





הערה : The length parameter became optional in PHP 4.2.0