PHP fpassthru() function and example


 

PHP fpassthru() function and example

In this section of PHP tutorial we will see the use of fpassthru() function and its related example

In this section of PHP tutorial we will see the use of fpassthru() function and its related example

Syntax
int fpassthru ( file_handle)

  • It reads the rest of the file contents from the current pointer. to the EOF.
  • It returns the no of character to the output console
  • If some function  has read the  file then it will not  read all, it will read only the rest.
  • To read the whole file use the rewind() function


Example of PHP fpassthru() Function

Code for PHP fpassthru() Function
<?php
    $file=fopen("c:/rose1/ram.txt","r");
    for($x=0;$x<=21;$x++)
      fgetc($file);
    $data1=fpassthru($file);
    echo $data1;
?>

Output
second line third line fourth line

Ads