File Reading-fread() Function in PHP With Example

aimtocode

PHP File Reading- fread():

Once a file is opened using fopen() function then it can be read by a function called fread()

The PHP fread() function is used to read the content of the file. It accepts two arguments: resource and file size.

The files size can be calculated using the filesize() function which takes the file name as its argument and returns the size of the file in bytes.

Syntax:


   string fread ( resource $handle , int $length )  

Example:




Reading a File Line by Line




Read Also:


aimtocode