<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.stream.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'de',
  ),
  'this' => 
  array (
    0 => 'function.stream-filter-prepend.php',
    1 => 'stream_filter_prepend',
    2 => 'Attach a filter to a stream',
  ),
  'up' => 
  array (
    0 => 'ref.stream.php',
    1 => 'Stream-Funktionen',
  ),
  'prev' => 
  array (
    0 => 'function.stream-filter-append.php',
    1 => 'stream_filter_append',
  ),
  'next' => 
  array (
    0 => 'function.stream-filter-register.php',
    1 => 'stream_filter_register',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/stream/functions/stream-filter-prepend.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.stream-filter-prepend" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">stream_filter_prepend</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.3.0, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">stream_filter_prepend</span> &mdash; <span class="dc-title">Attach a filter to a stream</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.stream-filter-prepend-description">
  <h3 class="title">Beschreibung</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>stream_filter_prepend</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">$stream</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$filter_name</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">$mode</code><span class="initializer"> = ?</span></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.mixed.php" class="type mixed">mixed</a></span> <code class="parameter">$params</code><span class="initializer"> = ?</span></span><br>): <span class="type"><a href="language.types.resource.php" class="type resource">resource</a></span></div>

  <p class="para rdfs-comment">
   Adds <code class="parameter">filter_name</code> to the list of filters
   attached to <code class="parameter">stream</code>.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.stream-filter-prepend-parameters">
  <h3 class="title">Parameter-Liste</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">stream</code></dt>
     <dd>
      <p class="para">
       The target stream.
      </p>
     </dd>
    
    
     <dt><code class="parameter">filter_name</code></dt>
     <dd>
      <p class="para">
       The filter name.
      </p>
     </dd>
    
    
     <dt><code class="parameter">mode</code></dt>
     <dd>
      <p class="para">
       By default, <span class="function"><strong>stream_filter_prepend()</strong></span> will
       attach the filter to the <code class="literal">read filter chain</code>
       if the file was opened for reading (i.e. File Mode:
       <code class="literal">r</code>, and/or <code class="literal">+</code>).  The filter
       will also be attached to the <code class="literal">write filter chain</code>
       if the file was opened for writing (i.e. File Mode:
       <code class="literal">w</code>, <code class="literal">a</code>, and/or <code class="literal">+</code>).
       <strong><code><a href="stream.constants.php#constant.stream-filter-read">STREAM_FILTER_READ</a></code></strong>,
       <strong><code><a href="stream.constants.php#constant.stream-filter-write">STREAM_FILTER_WRITE</a></code></strong>, and/or
       <strong><code><a href="stream.constants.php#constant.stream-filter-all">STREAM_FILTER_ALL</a></code></strong> can also be passed to the
       <code class="parameter">mode</code> parameter to override this behavior.
       See <span class="function"><a href="function.stream-filter-append.php" class="function">stream_filter_append()</a></span> for an example of
       using this parameter.
      </p>
     </dd>
    
    
     <dt><code class="parameter">params</code></dt>
     <dd>
      <p class="para">
       This filter will be added with the specified <code class="parameter">params</code>
       to the <em>beginning</em> of the list and will therefore be
       called first during stream operations.  To add a filter to the end of the
       list, use <span class="function"><a href="function.stream-filter-append.php" class="function">stream_filter_append()</a></span>.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.stream-filter-prepend-returnvalues">
  <h3 class="title">Rückgabewerte</h3>
  <p class="para">
   Returns a resource on success or <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> on failure. The resource can be
   used to refer to this filter instance during a call to
   <span class="function"><a href="function.stream-filter-remove.php" class="function">stream_filter_remove()</a></span>.
  </p>

  <p class="para">
   <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> is returned if <code class="parameter">stream</code> is not a resource or
   if <code class="parameter">filter_name</code> cannot be located.
  </p>
 </div>


 <div class="refsect1 notes" id="refsect1-function.stream-filter-prepend-notes">
  <h3 class="title">Anmerkungen</h3>
  <blockquote class="note"><p><strong class="note">Hinweis</strong>: 
   <strong>When using custom (user) filters</strong><br />
   <span class="simpara">
    <span class="function"><a href="function.stream-filter-register.php" class="function">stream_filter_register()</a></span> must be called first
    in order to register the desired user filter to <code class="parameter">filter_name</code>.
   </span>
  </p></blockquote>
  <blockquote class="note"><p><strong class="note">Hinweis</strong>: 
   <span class="simpara">
    Stream data is read from resources (both local and remote) in chunks,
    with any unconsumed data kept in internal buffers.  When a new
    filter is prepended to a stream, data in the internal buffers,
    which has already been processed through other filters will
    <em>not</em> be reprocessed through the new filter
    at that time.  This differs from the behavior of
    <span class="function"><a href="function.stream-filter-append.php" class="function">stream_filter_append()</a></span>.
   </span>
  </p></blockquote>
  <blockquote class="note"><p><strong class="note">Hinweis</strong>: 
   <span class="simpara">
    When a filter is added for read and write, two instances of the filter
    are created. <span class="function"><strong>stream_filter_prepend()</strong></span> must be called twice 
    with <strong><code><a href="stream.constants.php#constant.stream-filter-read">STREAM_FILTER_READ</a></code></strong> and 
    <strong><code><a href="stream.constants.php#constant.stream-filter-write">STREAM_FILTER_WRITE</a></code></strong> to get both filter resources.
   </span>
  </p></blockquote>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.stream-filter-prepend-seealso">
  <h3 class="title">Siehe auch</h3>
  <ul class="simplelist">
   <li><span class="function"><a href="function.stream-filter-register.php" class="function" rel="rdfs-seeAlso">stream_filter_register()</a> - Register a user defined stream filter</span></li>
   <li><span class="function"><a href="function.stream-filter-append.php" class="function" rel="rdfs-seeAlso">stream_filter_append()</a> - Attach a filter to a stream</span></li>
  </ul>
 </div>

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