<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: PHP - Redirect and continue (without abort)</title>
	<atom:link href="http://andrewensley.com/2009/06/php-redirect-and-continue-without-abort/feed/" rel="self" type="application/rss+xml" />
	<link>http://andrewensley.com/2009/06/php-redirect-and-continue-without-abort/</link>
	<description>My little contribution to the WWW</description>
	<lastBuildDate>Tue, 08 May 2012 00:58:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
<a href="http://andrewensley.com/seaworthy.php" style="padding:0;margin:0;" rel="nofollow"><div style="display:none;">trademarks</div></a>	<item>
		<title>By: Andrew</title>
		<link>http://andrewensley.com/2009/06/php-redirect-and-continue-without-abort/comment-page-1/#comment-141</link>
		<dc:creator>Andrew</dc:creator>
		<pubDate>Thu, 13 Aug 2009 20:40:33 +0000</pubDate>
		<guid isPermaLink="false">http://andrewensley.com/?p=185#comment-141</guid>
		<description>&lt;a href=&quot;#comment-139&quot; rel=&quot;nofollow&quot;&gt;@Alex &lt;/a&gt; 
The ob_end_clean() erases the output buffer to make sure nothing before that code might have been output to the browser.  If any content was to be output, the header() functions wouldn&#039;t work, and consequently, neither would the redirect.

As for starting and ending again: ob_flush() (actually ob_end_flush() in this case) and flush() are used together to make absolutely sure that all headers are sent to the browser immediately.  If you call ob_flush() and output buffering is off, it raises a PHP Notice.  So I avoid this by turning on output buffering first.

It is almost certainly overkill if you make sure you haven&#039;t output anything to the browser before running this code, but I wanted to make it robust enough to throw (almost) anywhere in a page and have it work.

The only scenario that would cause the code to fail would be if you never had output buffering on &lt;u&gt;and&lt;/u&gt; you output something to the browser before running this code.</description>
		<content:encoded><![CDATA[<p><a href="#comment-139" rel="nofollow">@Alex </a><br />
The ob_end_clean() erases the output buffer to make sure nothing before that code might have been output to the browser.  If any content was to be output, the header() functions wouldn't work, and consequently, neither would the redirect.</p>
<p>As for starting and ending again: ob_flush() (actually ob_end_flush() in this case) and flush() are used together to make absolutely sure that all headers are sent to the browser immediately.  If you call ob_flush() and output buffering is off, it raises a PHP Notice.  So I avoid this by turning on output buffering first.</p>
<p>It is almost certainly overkill if you make sure you haven't output anything to the browser before running this code, but I wanted to make it robust enough to throw (almost) anywhere in a page and have it work.</p>
<p>The only scenario that would cause the code to fail would be if you never had output buffering on <u>and</u> you output something to the browser before running this code.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alex</title>
		<link>http://andrewensley.com/2009/06/php-redirect-and-continue-without-abort/comment-page-1/#comment-139</link>
		<dc:creator>Alex</dc:creator>
		<pubDate>Thu, 13 Aug 2009 19:24:35 +0000</pubDate>
		<guid isPermaLink="false">http://andrewensley.com/?p=185#comment-139</guid>
		<description>Andrew, why do you use sequence ob_end_clean(),ob_start() before ob_end_flush()?
Does it has something to do with the headers sent or configuration calls?</description>
		<content:encoded><![CDATA[<p>Andrew, why do you use sequence ob_end_clean(),ob_start() before ob_end_flush()?<br />
Does it has something to do with the headers sent or configuration calls?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

