Easy Tutorial
❮ Func Curl_Init Func Http Header ❯

PHP fread() Function



Definition and Usage

The fread() function reads from an open file.

The function stops at the specified length or at the end of the file (EOF), whichever comes first.

It returns the read string, or FALSE on failure.

Syntax

string fread ( resource $handle , int $length )
Parameter Description
handle A file system pointer, typically created by fopen().
length Required. Specifies the maximum number of bytes to read.

Tips and Notes

Tip: This function is binary-safe. (This means both binary data, such as images, and character data can be written using this function.)


Example 1

Read 10 bytes from a file:


Example 2

Read the entire file:


❮ Func Curl_Init Func Http Header ❯