Current Location: Home> Function Categories> ob_get_clean

ob_get_clean

Get the current buffer content and delete the current output buffer
Name:ob_get_clean
Category:Output buffer control
Programming Language:php
One-line Description:Returns everything in the topmost output buffer and clears the buffer.

Definition and usage

ob_get_clean() function returns the contents of the output buffer and then deletes the contents from the buffer.

Example

Store the contents of the output buffer in a variable:

 <?php
ob_start ( ) ;
echo "Hello World!" ;
$contents = ob_get_clean ( ) ;
echo "The content of the buffer is:" ;
echo $contents ;
?>

Try it yourself

grammar

 ob_get_clean ( ) ;
Similar Functions
Popular Articles