You guys must know about Output Buffering in PHP.Last time, my friend Bhumi has written an article about Output Buffering in PHP where she has showed you how to turn on and use Output Buffering in PHP.
So Here I am going to share this great feature of PHP.Let’s see the flashback .Output buffering allows you to have all output of PHP code stored into an internal buffer instead of immediately transmitted to the browser and output buffering also allows you to include a file and store contents (HTML and PHP) to a string variable.here is one step ahead with one more good example for output buffering
ob_start(); //start the output buffer
//include the specified file
$output_buffer = ob_get_contents();
//return the contents of the output buffer
//remove the output buffer contents and end output buffering
Here in above code I have included
included-file.php file and displayed the whole content of the included file using output buffer.
That’s it. 🙂