Tags
PHP
Asked 7 years ago
1 Jul 2016
Views 1363
steave

steave posted

What is better use for output buffering instead of ob_start() in php?

i am using output buffering for the my webpages. it is as below



	
<?php
ob_start();
?>
<div id="r">
Why we use output buffering when it very slow
</div>
<?php 
ob_end_clean();
?>
	 


as i heard untill now from many developers that ob_start will slow your pages. than if it true i want to know which is better other way to avoid it and use output buffering as well.
yogi

yogi
answered Nov 30 '-1 00:00

yes its true it store output to buffer memory . suppose you start web page with ob_start(); and put ob_end_clean(); at end of the web page, so it will start buffering at starting of the web page and it will clean it at last until ob_end_clean() called.
so all output are not dispatched , stored in the memory , it will slow the process because it use lots of memory .

so avoid to use output buffering functions and try to find another solution which help to reduce memory consumption
Post Answer