In PHP, ob_end_flush() sends the contents of the active output buffer and then turns that top buffer off.
After a successful call, the nesting level drops by one. Use it when you are finished buffering and want the stored output to go out. To send but keep buffering, use ob_flush() instead.
Syntax
Call ob_end_flush() with the values you need. Start with this line.
PHP
$ok = ob_end_flush();
Call
What it does
ob_end_flush()
Flushes and ends the active buffer; returns true on success.
ob_start(); echo "hi"; ob_end_flush();
Sends "hi" and turns buffering off.
ob_get_level()
Drops by one after a successful ob_end_flush().
With nested buffers, the flushed text goes to the next outer buffer (or to the real output if this was the last buffer). ob_end_flush() does not return the string; use ob_get_flush() when you need both the text and a flush-and-end.
Library declarations
PHP
ob_end_flush(): bool
Parameters
Parameter
Description
—
This function takes no parameters.
Return Value
Return Value
Description
bool
true on success, false on failure.
PHP Examples
Example 1 — Flush and End a Buffer
Buffer a greeting, then ob_end_flush() so the greeting prints and buffering stops.