Last updated on May 26th, 2016 at 01:46 pm

VN:F [1.9.22_1171]
Rating: 6.0/10 (1 vote cast)

PHP Output buffering using ob_start

Output buffering using ob_start in php and saving it to a variable, This is a very good feature available in PHP mainly when we want to output an HTML website.

 ob_start(); //Turn on output buffering ?>
Get this link <a href="http://www.mistonline.in">output buffer</a>
<div class="style">Rest of html</div>
<?php $get_html = ob_get_clean(); //copy current buffer contents into $get_html variable and delete current output buffer
echo $get_html;
VN:F [1.9.22_1171]
Rating: 6.0/10 (1 vote cast)

Leave a Reply

Your email address will not be published. Required fields are marked *