PHP ob_get_flush() Function
❮ PHP Output Control Functions
Example
Store the contents of an output buffer in a variable:
<?php
ob_start();
echo "Hello World!";
$contents =
ob_get_flush();
echo "<br>";
echo "The contents of the buffer were:
";
echo $contents;
?>
Try it Yourself »
Definition and Usage
The ob_get_flush()
function outputs the contents of the topmost output buffer, returns the
contents and the deletes the buffer. The output may be caught by another output buffer or,
if there are no other output buffers, sent directly to the browser.
Syntax
ob_get_flush();
Technical Details
Return Value: | Returns a string containing the contents of the buffer |
---|---|
PHP Version: | 4.3+ |
❮ PHP Output Control Functions