<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/outcontrol.examples.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'en',
  ),
  'this' => 
  array (
    0 => 'outcontrol.examples.basic.php',
    1 => 'Basic usage',
    2 => 'Basic usage',
  ),
  'up' => 
  array (
    0 => 'outcontrol.examples.php',
    1 => 'Examples',
  ),
  'prev' => 
  array (
    0 => 'outcontrol.examples.php',
    1 => 'Examples',
  ),
  'next' => 
  array (
    0 => 'outcontrol.examples.rewrite.php',
    1 => 'Output rewrite usage',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/outcontrol/examples.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="outcontrol.examples.basic" class="section">
  <h2 class="title">Basic usage</h2>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Example #1 Output Control example</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /><br />ob_start</span><span style="color: #007700">();<br />echo </span><span style="color: #DD0000">"Hello\n"</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">setcookie</span><span style="color: #007700">(</span><span style="color: #DD0000">"cookiename"</span><span style="color: #007700">, </span><span style="color: #DD0000">"cookiedata"</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">ob_end_flush</span><span style="color: #007700">();<br /><br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

   </div>
  </p>
  <p class="para">
   In the above example, the output from <span class="function"><a href="function.echo.php" class="function">echo</a></span>
   would be stored in the output buffer until
   <span class="function"><a href="function.ob-end-flush.php" class="function">ob_end_flush()</a></span> was called. In the mean time,
   the call to <span class="function"><a href="function.setcookie.php" class="function">setcookie()</a></span> successfully stored a
   cookie without causing an error. (Headers cannot normally be sent
   to the browser after data has already been sent.)
  </p>
 </div><?php manual_footer($setup); ?>