Current Location: Home> Function Categories> ob_get_flush

ob_get_flush

Flush the output buffer, return it as a string and close the output buffer
Name:ob_get_flush
Category:Output buffer control
Programming Language:php
One-line Description:Output and return the contents of the top-most output buffer, and then delete the buffer.

Definition and usage

The ob_get_flush() function outputs the content of the top-level output buffer, returns the content, and deletes the buffer. The output may be captured by another output buffer, or, if there is no other output buffer, sent directly to the browser.

Example

Store the contents of the output buffer in a variable:

 <?php
ob_start ( ) ;
echo "Hello World!" ;
$contents = ob_get_flush ( ) ;

echo "<br>" ;
echo "The content of the buffer is:" ;
echo $contents ;
?>

Try it yourself

grammar

 ob_get_flush ( ) ;
Similar Functions
Popular Articles