PHP Function Reference

PHP ob_flush() Function



The PHP ob_flush() function flushes the contents of the output buffer. This function does not destroy the output buffer like ob_end_flush() does.

Syntax

ob_flush()

Parameters

No parameter is required.

Return Value

Returns true on success or false on failure.

Example: ob_flush() example

The example below shows the usage of ob_flush() function.

<?php
//turn on the output buffering
ob_start();

echo "This content will be cleaned from the output buffer.";

//clearing the output buffer
ob_clean();

echo "New content is added to the output buffer.";

//flushing the output buffer
ob_flush();

//clearing the output buffer and turning it off
ob_end_clean();
?>

The output of the above code will be:

New content is added to the output buffer.

❮ PHP Output Control Reference