• View our reviews on Hot Scripts
  • JS Tutorial

Recent Comments

Powered by Disqus

Back to articles

Output buffering

So why should you use output buffering. First of all, because you can send headers any where in the script without worrying, that headers are sent after output, thus eliminating header error. And next thing you can manipulate with content even after all output done and before it was sent to browser.

Here is an example of output buffer usage:


function callback($buffer)
    return (str_replace("before", "after", $buffer));

echo "<p>UTF=8 content:</p>";
echo "<p>Āģķļī</p>";
<p>Some more html before headers</p>

//sending headers
header('Content-Type:text/html; charset=UTF-8');


You may also be interested in:

Powered by

blog comments powered by Disqus