English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Basic PHP Tutorial

Advanced PHP Tutorial

PHP & MySQL

PHP Reference Manual

PHP fflush() Function Usage and Example

PHP Filesystem Reference Manual

The fflush() function writes all buffered output to the opened file, and returns true if successful, otherwise false.

Syntax

bool fflush ( resource $handle )

This function forces all buffered output to be written to the resource pointed to by the file handle.

Online Example

<?php
   $file = fopen("/PhpProject/sample.txt", "r+");
   // some code
   fflush($file);
   echo $file;
   fclose($file);
?>

Output result

Resource id #5

PHP Filesystem Reference Manual