In this article, you will learn how to get the content of the output buffer which is currently placed a the top of the stack, and then delete the content. The ob_get_clean() function in PHP returns the contents of the output buffer and then deletes the contents from the buffer.
what is the syntax of the OB_GET_CLEAN() function in php?
examples of the OB_GET_CLEAN() function
Example 1. In this example, we store the contents of an output buffer in a variable.
<?php ob_start(); echo "Hello World!"; $contents = ob_get_clean(); echo "The contents of the buffer are: "; echo $contents; ?>