PHP Tutorial - PHP fflush() Function






Definition

The fflush() function writes all buffered output to an open file.

Syntax

PHP fflush() Function has the following syntax.

fflush(file)

Parameter

ParameterIs RequiredDescription
fileRequired.Open file stream to check

Return

PHP fflush() Function returns TRUE on success and FALSE on failure.

Example

Writes all buffered output to an open file


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