Home  >  Article  >  Backend Development  >  fpassthru() function in PHP

fpassthru() function in PHP

王林
王林forward
2023-09-07 20:21:04666browse

fpassthru() function in PHP

fpassthru() function reads data from an open file until EOF and writes the result to the output buffer. It returns the number of characters read from the file pointer, or FALSE if an error occurred.

Syntax

fpassthru(file_pointer):

Parameters

  • file_pointer - The file pointer must point to the file successfully opened by fopen() or fsockopen() file (and has not been closed by fclose().

Returns

The fpassthru() function returns the number of characters read from the file pointer, otherwise if an error occurs FALSE.

Example

<?php
   $file_pointer = fopen("new.txt","r");
   fgets($file);
   echo fpassthru($file_pointer);
   fclose($file_pointer);
?>

The following is the output. The number of characters is 22.

Output

Demo text!!
This is it!22

The above is the detailed content of fpassthru() function in PHP. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete