ob_get_contents
Returns the contents of the output buffer
ob_get_contents()
function returns the contents of the top-most output buffer.
Store the contents of the output buffer in a variable:
<?php ob_start ( ) ; echo "Hello World!" ; $contents = ob_get_contents ( ) ; ob_end_clean ( ) ; echo "The content of the buffer is:" ; echo $contents ; ?>
Try it yourself
ob_get_contents ( ) ;