Home Tutorial Php Phpfiles PHP fpassthru() function and example

 
 

PHP fpassthru() function and example
Posted on: October 29, 2009 at 12:00 AM
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

Related Tags for PHP fpassthru() function and example:


Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.