php8.5
Home/ Manual/ spl / splfileobject/ SplFileObject::fflush

SplFileObject::fflush

PHP function Edit on GitHub ✎

(PHP 5 >= 5.1.0, PHP 7, PHP 8)

Flushes the output to the file

Description

SplFileObject::fflush(): bool

Forces a write of all buffered output to the file.

Parameters Parameters

Return Values

Success

Examples

SplFileObject::fflush example

php
<?php
$file = new SplFileObject('misc.txt', 'r+');
$file->rewind();
$file->fwrite("Foo");
$file->fflush();
$file->ftruncate($file->ftell());
?>

See Also

  • SplFileObject::fwrite

Source: reference/spl/splfileobject/fflush.xml · from the official PHP manual (php/doc-en)