Example 1
ob_start(); // captures the output and save it in an internal buffer
echo("world!"); // "world!" saved in internal buffer
$output = ob_get_contents(); // save in a variable internal buffer content
ob_end_clean(); // clean internal buffer
echo 'Hello ' . $output;
// output
// Hello world!
Example 2
ob_start();
echo("Hello world!");
$output = ob_get_contents();
ob_end_flush(); // print internal buffer content
// output
// Hello world!
Comments
Post a Comment