<?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 => 'ru',
  ),
  'this' => 
  array (
    0 => 'function.stream-filter-prepend.php',
    1 => 'stream_filter_prepend',
    2 => 'Прикрепляет фильтр к потоку',
  ),
  'up' => 
  array (
    0 => 'ref.stream.php',
    1 => 'Функции для работы с потоками',
  ),
  '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' => 'ru',
    '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">Прикрепляет фильтр к потоку</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.stream-filter-prepend-description">
  <h3 class="title">Описание</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">$filtername</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">$read_write</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">
   Добавляет <code class="parameter">filtername</code> к списку фильтров,
   прикреплённых к потоку <code class="parameter">stream</code>.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.stream-filter-prepend-parameters">
  <h3 class="title">Список параметров</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">stream</code></dt>
     <dd>
      <p class="para">
       Целевой поток.
      </p>
     </dd>
    
    
     <dt><code class="parameter">filtername</code></dt>
     <dd>
      <p class="para">
       Название потока.
      </p>
     </dd>
    
    
     <dt><code class="parameter">read_write</code></dt>
     <dd>
      <p class="para">
       По умолчанию, функция <span class="function"><strong>stream_filter_prepend()</strong></span> будет
       прикреплять фильтр к <code class="literal">цепочке фильтров чтения</code>,
       если файл был открыт для чтения (т.е. режим файла:
       <code class="literal">r</code>, и/или <code class="literal">+</code>). Фильтр
       также будет прикреплён к <code class="literal">цепочке фильтров записи</code>,
       если файл был открыт для записи (т.е. режим файла:
       <code class="literal">w</code>, <code class="literal">a</code>, и/или <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> и/или
       <strong><code><a href="stream.constants.php#constant.stream-filter-all">STREAM_FILTER_ALL</a></code></strong> также могут быть переданы в параметре
       <code class="parameter">read_write</code>, чтобы переопределить это поведение.
       Смотрите функцию <span class="function"><a href="function.stream-filter-append.php" class="function">stream_filter_append()</a></span> для примера
       использования этого параметра.
      </p>
     </dd>
    
    
     <dt><code class="parameter">params</code></dt>
     <dd>
      <p class="para">
       Этот фильтр будет добавлен с указанными параметрами <code class="parameter">params</code>
       к <em>началу</em> списка и, таким образом, будет
       вызван первым во время потоковых операций. Для того, чтобы добавить фильтр к концу
       списка, используйте <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">Возвращаемые значения</h3>
  <p class="para">
   Возвращает ресурс в случае успешного выполнения или <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> в случае возникновения ошибки. Ресурс должен быть
   использован для ссылки на этот экземпляр фильтра во время вызова
   <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>, если <code class="parameter">stream</code> не является ресурсом или если
   <code class="parameter">filtername</code> не найден.
  </p>
 </div>


 <div class="refsect1 notes" id="refsect1-function.stream-filter-prepend-notes">
  <h3 class="title">Примечания</h3>
  <blockquote class="note"><p><strong class="note">Замечание</strong>: 
   <strong>При использовании пользовательских фильтров</strong><br />
   <span class="simpara">
    Сначала должна быть вызвана функция <span class="function"><a href="function.stream-filter-register.php" class="function">stream_filter_register()</a></span>
    для того, чтобы зарегистрировать желаемый пользовательский фильтр на имя <code class="parameter">filtername</code>.
   </span>
  </p></blockquote>
  <blockquote class="note"><p><strong class="note">Замечание</strong>: 
   <span class="simpara">
    Потоковые данные читаются из ресурсов (как локальных, так удалённых) по кускам,
    и любые невостребованные данные сохраняются во внутренних буферах. Когда новый фильтр
    добавляется в начало потока, данные во внутренних буферах,
    который уже были обработаны через другие фильтры,
    <em>не</em> будут обработаны через новый фильтр.
    Это отличается от поведения функции <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">Замечание</strong>: 
   <span class="simpara">
    Когда фильтр добавляется для чтения и записи, создаются два экземпляра
    фильтра. Функция <span class="function"><a href="function.stream-filter-append.php" class="function">stream_filter_append()</a></span> должна быть вызвана дважды
    с <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> чтобы получить оба ресурса фильтра.
   </span>
  </p></blockquote>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.stream-filter-prepend-seealso">
  <h3 class="title">Смотрите также</h3>
  <ul class="simplelist">
   <li><span class="function"><a href="function.stream-filter-register.php" class="function" rel="rdfs-seeAlso">stream_filter_register()</a> - Регистрирует пользовательский фильтр потока</span></li>
   <li><span class="function"><a href="function.stream-filter-append.php" class="function" rel="rdfs-seeAlso">stream_filter_append()</a> - Прикрепляет фильтр к потоку</span></li>
  </ul>
 </div>

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