readfile() function in PHP

PHPProgrammingServer Side Programming

The readfile() function read a file and writes it to the output buffer.

Syntax

readfile(file_path, include_path, context)

Parameters

  • file_path − The path of the file

  • include_path − Set this parameter to TRUE, if you want to search for the file in the include_path

  • context − Specifies the behavior of the stream.

Return

The readfile() function returns the number of bytes read from the file.

Example

<?php
   echo readfile("one.txt");
?>

The following is the output that returns the number of bytes.

Output

This is demo text!
18
raja
Updated on 24-Jun-2020 09:32:58

Advertisements