In this article, you will learn how to get or print the contents of the output buffer currently being at the top of the stack. The ob_get_flush() function in PHP outputs the contents of the topmost output buffer, returns the contents, and 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.
what is the syntax of the OB_GET_FLUSH() function in php?
ob_get_flush();
examples of the OB_GET_FLUSH() 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_flush();
echo "<br>";
echo "The contents of the buffer were: ";
echo $contents;
?>