da__smith Posted February 7, 2008 Share Posted February 7, 2008 Hi PHP Freaks Does PHP clean up properly (i.e. ob_flush();flush() if an ob_start is unflushed/uncleaned before the end of the PHP file? PHP version 5 is in use. To illustrate the question I know that the following, very much simplified, example outputs PHP/HTML to the browser: ---PHP file, called by the browser, start--- ob_start(); ...PHP/HTML ---PHP file, called by the browser, end--- The buffer is outputted to the browser, which means that PHP flushes at the end of the PHP file. Does PHP flush/clean *everything* at the end of the file? Will there be any server/PHP issues with this? all the best Dave Quote Link to comment https://forums.phpfreaks.com/topic/89884-solved-does-php-clean-up-properly-at-the-end-of-file-if-an-ob_start-is-unflushed/ Share on other sites More sharing options...
aschk Posted February 7, 2008 Share Posted February 7, 2008 PHP cleans up EVERYTHING at the end of any http request so whether it's flushed or not shouldn't affect anything being held in memory after the request has been completed. If only we actually had persistence in PHP (without sessions)... "oh hark ye olde days of desktop programming!" Quote Link to comment https://forums.phpfreaks.com/topic/89884-solved-does-php-clean-up-properly-at-the-end-of-file-if-an-ob_start-is-unflushed/#findComment-460645 Share on other sites More sharing options...
haku Posted February 7, 2008 Share Posted February 7, 2008 output buffering (ob_start) is lazy programming and shouldn't be used. Quote Link to comment https://forums.phpfreaks.com/topic/89884-solved-does-php-clean-up-properly-at-the-end-of-file-if-an-ob_start-is-unflushed/#findComment-460744 Share on other sites More sharing options...
da__smith Posted February 7, 2008 Author Share Posted February 7, 2008 @haku: Aside from the lazy programming label, Why should it not be used? Is there a technical or performance reason for not using it? Quote Link to comment https://forums.phpfreaks.com/topic/89884-solved-does-php-clean-up-properly-at-the-end-of-file-if-an-ob_start-is-unflushed/#findComment-460810 Share on other sites More sharing options...
da__smith Posted February 8, 2008 Author Share Posted February 8, 2008 Thanks aschk for your help all the best Dave Quote Link to comment https://forums.phpfreaks.com/topic/89884-solved-does-php-clean-up-properly-at-the-end-of-file-if-an-ob_start-is-unflushed/#findComment-461741 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.