|
ob_get_flush
Flush the output buffer, return it as a string and turn off output buffering
(PHP 4 >= 4.3.0, PHP 5)
Example 1687. ob_get_flush() example<?php The above example will output: Array Code Examples / Notes » ob_get_flushzubin@byron
I found this function is useful for storing output instead of displaying it. For example, I wanted to use an old function which echoed the ouput but I wanted it in a variable, not outputted immediately. Here's how: <?php // start generating html $html = '<html><head>'; // etc // start output buffering ob_start(); // call function which outputs immediately print_menu(); // append this to $html $html .= ob_get_flush(); // empty output buffer ob_clean(); ?> |