The fflush() function flushes the output to an open file. This function forces a write of all buffered output to the resource pointed to by the file handle.
Syntax
fflush(file_pointer)
Parameters
file_pointer − Specify the open file stream.
Return
The fflush() function returns.
- TRUE on success
- FALSE on failure
Example
<?php
$file_pointer = fopen("one.txt","r+");
fflush($file_pointer);
?>Output
test line
Let us see another example.
Example
<?php
$file_pointer = fopen("two.txt", "r");
$res = fgets($file_pointer);
while(! feof($file_pointer))
fflush($check);
fclose($file_pointer);
?>Output
Java is a programming language. JavaScript is a scripting language.