fpassthru() function in PHP

王林
Release: 2023-09-07 20:22:01
forward
657 people have browsed it

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):
Copy after login

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);
?>
Copy after login

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

Output

Demo text!!
This is it!22
Copy after login

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

Related labels:
source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!