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.
fpassthru(file_pointer):
file_pointer - The file pointer must point to the file successfully opened by fopen() or fsockopen() file (and has not been closed by fclose().
The fpassthru() function returns the number of characters read from the file pointer, otherwise if an error occurs FALSE.
<?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.
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!