flush()

flush() — Flush system output buffer.

Built-in function of PHP 8.5. The manual lists it as available in PHP 4, PHP 5, PHP 7, PHP 8. This page is the reference card: signature, parameters and return value, plus the changelog and the example the manual provides.

What it does

Flushes the system write buffers of PHP and the backend used by PHP (e.g.: CGI, a web server). In a command line environment flush() will attempt to flush the contents of the buffers only whereas in a web context headers and the contents of the buffers are flushed.

Signature

flush(): void

Parameters

This function takes no parameters.

Return value

No value is returned.

Example

The PHP manual ships no example for flush(); the signature and the parameter table above are the contract.

Changelog

VersionChange
8.4.0Flushing headers without a body will now succeed in FastCGI.

See also

ob_flush(), ob_clean(), ob_end_flush(), ob_end_clean()

All PHP 8.5 built-in functions

Reference card built from the PHP manual page flush() (PHP documentation, CC BY 3.0). The page is generated from the manual, so the wording of the parameter and return value text follows php.net.