<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/outcontrol.user-level-output-buffers.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'it',
  ),
  'this' => 
  array (
    0 => 'outcontrol.working-with-output-handlers.php',
    1 => 'Working With Output Handlers',
    2 => 'Working With Output Handlers',
  ),
  'up' => 
  array (
    0 => 'outcontrol.user-level-output-buffers.php',
    1 => 'User-Level Output Buffers',
  ),
  'prev' => 
  array (
    0 => 'outcontrol.output-handlers.php',
    1 => 'Output Handlers',
  ),
  'next' => 
  array (
    0 => 'outcontrol.flags-passed-to-output-handlers.php',
    1 => 'Flags Passed To Output Handlers',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/outcontrol/user-level-output-buffers.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="outcontrol.working-with-output-handlers" class="section">
  <h2 class="title">Working With Output Handlers</h2>
  <p class="para">
   When invoked, output handlers are passed the contents of the buffer
   and a bitmask indicating the status of output buffering.
  </p>
  <p class="para">
   <div class="methodsynopsis dc-description">
    <span class="methodname">
     <span class="replaceable">handler</span>
    </span>(<span class="methodparam">
     
     <span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$buffer</code>
    </span>, <span class="methodparam">
     
     <span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$phase</code>
    <span class="initializer"> = ?</span></span>): <span class="type"><a href="language.types.string.php" class="type string">string</a></span></div>

   <dl>
    
     <dt><code class="parameter">buffer</code></dt>
     <dd>
      <span class="simpara">
       Contents of the output buffer.
      </span>
     </dd>
    
    
     <dt><code class="parameter">phase</code></dt>
     <dd>
      <span class="simpara">
       Bitmask of
       <a href="outcontrol.constants.php#constant.php-output-handler-start" class="link">
        <strong><code><a href="outcontrol.constants.php#constant.php-output-handler-start">PHP_OUTPUT_HANDLER_<span class="replaceable">*</span></a></code></strong>
        constants
       </a>.
      </span>
     </dd>
    
   </dl>
  </p>
  <div class="warning"><strong class="warning">Avviso</strong>
   <p class="simpara">
    Calling any of the following functions from within an output handler
    will result in a fatal error:
    <span class="function"><a href="function.ob-clean.php" class="function">ob_clean()</a></span>, <span class="function"><a href="function.ob-end-clean.php" class="function">ob_end_clean()</a></span>,
    <span class="function"><a href="function.ob-end-flush.php" class="function">ob_end_flush()</a></span>, <span class="function"><a href="function.ob-flush.php" class="function">ob_flush()</a></span>,
    <span class="function"><a href="function.ob-get-clean.php" class="function">ob_get_clean()</a></span>, <span class="function"><a href="function.ob-get-flush.php" class="function">ob_get_flush()</a></span>,
    <span class="function"><a href="function.ob-start.php" class="function">ob_start()</a></span>.
   </p>
  </div>
  <blockquote class="note"><p><strong class="note">Nota</strong>: 
   <span class="simpara">
    If the <strong><code><a href="outcontrol.constants.php#constant.php-output-handler-disabled">PHP_OUTPUT_HANDLER_DISABLED</a></code></strong> of a handler is set,
    the handler will not be invoked by calling
    <span class="function"><a href="function.ob-end-clean.php" class="function">ob_end_clean()</a></span>, <span class="function"><a href="function.ob-end-flush.php" class="function">ob_end_flush()</a></span>,
    <span class="function"><a href="function.ob-get-clean.php" class="function">ob_get_clean()</a></span>, <span class="function"><a href="function.ob-get-flush.php" class="function">ob_get_flush()</a></span>,
    <span class="function"><a href="function.ob-clean.php" class="function">ob_clean()</a></span>,
    <span class="function"><a href="function.ob-flush.php" class="function">ob_flush()</a></span>
    or during PHP&#039;s shutdown process.
    Prior to PHP 8.4.0, this flag had no effect when calling <span class="function"><a href="function.ob-clean.php" class="function">ob_clean()</a></span>
    or <span class="function"><a href="function.ob-flush.php" class="function">ob_flush()</a></span>.
   </span>
  </p></blockquote>
  <blockquote class="note"><p><strong class="note">Nota</strong>: 
   <span class="simpara">
    The working directory of the script can change inside the shutdown function
    under some web servers, e.g. Apache or the built-in web server.
   </span>
  </p></blockquote>
 </div><?php manual_footer($setup); ?>