0

Syntax

bool fflush ( resource $handle );

Definition and Usage

This function forces a write of all buffered output to the resource pointed to by the file handle.

Paramters

ParameterDescription
handleThe file pointer must be valid, and must point to a file successfully opened by fopen() or fsockopen() (and not yet closed by fclose()).

Return Value

Returns TRUE on success or FALSE on failure.

Example

Following is the usage of this function:

<?php
if ($f = fopen('myfile.txt', 'r')) do {
    $line = fgets($f);
    echo "$line";
    // do any stuff here...
} while (!feof($f));
fflush($f);
// do any stuff here...
fclose($f);
?>

Post a Comment

 
Top