English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Basic PHP Tutorial

Advanced PHP Tutorial

PHP & MySQL

PHP Reference Manual

Usage and Example of PHP fpassthru() Function

PHP Filesystem Reference Manual

The fpassthru() function can read all data from the opened file from the current position until EOF and write the result to the output buffer. This function can return the number of characters passed, or false on failure.

Syntax

int fpassthru ( resource $handle )

When using the fpassthru() function with binary files on Windows systems, the file must be opened in binary mode.

Online Example

<?php
   $file = fopen("sample.txt", "r");
 
   //Read the first line
   fgets($file);
   //Send the remaining part of the file to the output buffer
   echo fpassthru($file);
   fclose($file);
?>

Output Result

Tutorix7

PHP Filesystem Reference Manual