<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.php-user-filter.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'de',
  ),
  'this' => 
  array (
    0 => 'php-user-filter.filter.php',
    1 => 'php_user_filter::filter',
    2 => 'Called when applying the filter',
  ),
  'up' => 
  array (
    0 => 'class.php-user-filter.php',
    1 => 'php_user_filter',
  ),
  'prev' => 
  array (
    0 => 'class.php-user-filter.php',
    1 => 'php_user_filter',
  ),
  'next' => 
  array (
    0 => 'php-user-filter.onclose.php',
    1 => 'php_user_filter::onClose',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/stream/php_user_filter/filter.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="php-user-filter.filter" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">php_user_filter::filter</h1>
  <p class="verinfo">(PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">php_user_filter::filter</span> &mdash; <span class="dc-title">Called when applying the filter</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-php-user-filter.filter-description">
  <h3 class="title">Beschreibung</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>php_user_filter::filter</strong></span>(<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.resource.php" class="type resource">resource</a></span> <code class="parameter">$in</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.resource.php" class="type resource">resource</a></span> <code class="parameter">$out</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter reference">&$consumed</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span> <code class="parameter">$closing</code></span><br>): <span class="type"><a href="language.types.integer.php" class="type int">int</a></span></div>

  <p class="para rdfs-comment">
   This method is called whenever data is read from or written to
   the attached stream (such as with <span class="function"><a href="function.fread.php" class="function">fread()</a></span> or <span class="function"><a href="function.fwrite.php" class="function">fwrite()</a></span>).
  </p>

 </div>


 <div class="refsect1 parameters" id="refsect1-php-user-filter.filter-parameters">
  <h3 class="title">Parameter-Liste</h3>
  <dl>
   
    <dt><code class="parameter">in</code></dt>
    <dd>
     <p class="para">
      <code class="parameter">in</code> is a resource pointing to a <code class="literal">bucket brigade</code>
      which contains one or more <code class="literal">bucket</code> objects containing data to be filtered.
     </p>
    </dd>
   
   
    <dt><code class="parameter">out</code></dt>
    <dd>
     <p class="para">
      <code class="parameter">out</code> is a resource pointing to a second <code class="literal">bucket brigade</code>
      into which your modified buckets should be placed.
     </p>
    </dd>
   
   
    <dt><code class="parameter">consumed</code></dt>
    <dd>
     <p class="para">
      <code class="parameter">consumed</code>, which must <em>always</em>
      be declared by reference, should be incremented by the length of the data
      which your filter reads in and alters.  In most cases this means you will
      increment <code class="parameter">consumed</code> by <code class="literal">$bucket-&gt;datalen</code>
      for each <code class="literal">$bucket</code>.
     </p>
    </dd>
   
   
    <dt><code class="parameter">closing</code></dt>
    <dd>
     <p class="para">
      If the stream is in the process of closing
      (and therefore this is the last pass through the filterchain),
      the <code class="parameter">closing</code> parameter will be set to <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong>.
     </p>
    </dd>
   
  </dl>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-php-user-filter.filter-returnvalues">
  <h3 class="title">Rückgabewerte</h3>
  <p class="para">
   The <span class="methodname"><strong>filter()</strong></span> method must return one of
   three values upon completion.
   <table class="doctable informaltable">
    
     <thead>
      <tr>
       <th>Return Value</th>
       <th>Meaning</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td><strong><code><a href="stream.constants.php#constant.psfs-pass-on">PSFS_PASS_ON</a></code></strong></td>
       <td>
        Filter processed successfully with data available in the
        <code class="parameter">out</code> <code class="literal">bucket brigade</code>.
       </td>
      </tr>

      <tr>
       <td><strong><code><a href="stream.constants.php#constant.psfs-feed-me">PSFS_FEED_ME</a></code></strong></td>
       <td>
        Filter processed successfully, however no data was available to
        return. More data is required from the stream or prior filter.
       </td>
      </tr>

      <tr>
       <td><strong><code><a href="stream.constants.php#constant.psfs-err-fatal">PSFS_ERR_FATAL</a></code></strong> (default)</td>
       <td>
        The filter experienced an unrecoverable error and cannot continue.
       </td>
      </tr>

     </tbody>
    
   </table>

  </p>
 </div>



</div><?php manual_footer($setup); ?>