← All built-ins / fread()
fread()
fread(...$args): string
Parameters
| Name | Type | Description |
|---|---|---|
| $handle | resource | handle from fopen() |
| $max | int | maximum bytes to read |
Return value
Up to $max bytes as a string.
Example
file_put_contents("/tmp/hphp_doc_fr.txt", "abcdef");
$fh = fopen("/tmp/hphp_doc_fr.txt", "rb");
echo fread($fh, 3);
fclose($fh);abc