← All built-ins / fgets()
fgets()
fgets(string $s): string
Parameters
| Name | Type | Description |
|---|---|---|
| $handle | resource | handle from fopen() in read mode |
Return value
One line including its newline; false at end of file.
Example
file_put_contents("/tmp/hphp_doc_l.txt", "one\ntwo\n");
$fh = fopen("/tmp/hphp_doc_l.txt", "r");
echo rtrim(fgets($fh)), "
";
echo rtrim(fgets($fh)), "
";
fclose($fh);one two