<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.streamwrapper.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'ru',
  ),
  'this' => 
  array (
    0 => 'streamwrapper.stream-read.php',
    1 => 'streamWrapper::stream_read',
    2 => 'Читает из потока',
  ),
  'up' => 
  array (
    0 => 'class.streamwrapper.php',
    1 => 'streamWrapper',
  ),
  'prev' => 
  array (
    0 => 'streamwrapper.stream-open.php',
    1 => 'streamWrapper::stream_open',
  ),
  'next' => 
  array (
    0 => 'streamwrapper.stream-seek.php',
    1 => 'streamWrapper::stream_seek',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'ru',
    'path' => 'reference/stream/streamwrapper/stream-read.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="streamwrapper.stream-read" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">streamWrapper::stream_read</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.3.2, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">streamWrapper::stream_read</span> &mdash; <span class="dc-title">Читает из потока</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-streamwrapper.stream-read-description">
  <h3 class="title">Описание</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>streamWrapper::stream_read</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$count</code></span>): <span class="type"><span class="type"><a href="language.types.string.php" class="type string">string</a></span>|<span class="type"><a href="language.types.singleton.php" class="type false">false</a></span></span></div>

  <p class="para rdfs-comment">
   Этот метод вызывается в процессе выполнения функций
   <span class="function"><a href="function.fread.php" class="function">fread()</a></span> и <span class="function"><a href="function.fgets.php" class="function">fgets()</a></span>.
  </p>
  <blockquote class="note"><p><strong class="note">Замечание</strong>: 
   <p class="para">
    Не забывайте обновлять позицию чтения/записи в потоке (на количество успешно
    прочитанных байт).
   </p>
  </p></blockquote>

 </div>


 <div class="refsect1 parameters" id="refsect1-streamwrapper.stream-read-parameters">
  <h3 class="title">Список параметров</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">count</code></dt>
     <dd>
      <p class="para">
       Сколько байт данных от текущей позиции должно быть возвращено.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-streamwrapper.stream-read-returnvalues">
  <h3 class="title">Возвращаемые значения</h3>
  <p class="para">
   Если в потоке количество доступных байт меньше, чем <code class="parameter">count</code>,
   должно быть возвращено столько данных, сколько доступно.
   Если доступных данных больше нет, функция возвращает <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>.
  </p>
 </div>


 <div class="refsect1 errors" id="refsect1-streamwrapper.stream-read-errors">
  <h3 class="title">Ошибки</h3>
  <p class="para">Вызывает ошибку уровня
<strong><code><a href="errorfunc.constants.php#constant.e-warning">E_WARNING</a></code></strong>, если вызов к этому методу не удался
(например, не реализован).</p>
  <blockquote class="note"><p><strong class="note">Замечание</strong>: 
   <p class="para">
    Если возвращаемое значение будет больше, чем <code class="parameter">count</code>,
    то будет вызвана ошибка <strong><code><a href="errorfunc.constants.php#constant.e-warning">E_WARNING</a></code></strong>, и данные более
    указанного количества будут потеряны.
   </p>
  </p></blockquote>
 </div>





 <div class="refsect1 notes" id="refsect1-streamwrapper.stream-read-notes">
  <h3 class="title">Примечания</h3>
  <blockquote class="note"><p><strong class="note">Замечание</strong>: 
   <p class="para">
    <span class="methodname"><a href="streamwrapper.stream-eof.php" class="methodname">streamWrapper::stream_eof()</a></span> вызывается сразу после вызова
    <span class="methodname"><strong>streamWrapper::stream_read()</strong></span>, чтобы проверить,
    достигнут ли конец файла <abbr title="End Of File">EOF</abbr>. Если метод не реализован, то
    полагается, что конец файла <abbr title="End Of File">EOF</abbr> достигнут.
   </p>
  </p></blockquote>
  <div class="warning"><strong class="warning">Внимание</strong>
    <p class="para">
      При чтении файла целиком (например, функцией
      <span class="function"><a href="function.file-get-contents.php" class="function">file_get_contents()</a></span>), PHP будет вызывать
      <span class="methodname"><strong>streamWrapper::stream_read()</strong></span> и вместе с ним
      <span class="methodname"><a href="streamwrapper.stream-eof.php" class="methodname">streamWrapper::stream_eof()</a></span> в цикле, пока
      <span class="methodname"><strong>streamWrapper::stream_read()</strong></span> возвращает
      непустую строку. Возвращаемое из
      <span class="methodname"><a href="streamwrapper.stream-eof.php" class="methodname">streamWrapper::stream_eof()</a></span> значение при этом
      игнорируется.
    </p>
  </div>
 </div>


 <div class="refsect1 seealso" id="refsect1-streamwrapper.stream-read-seealso">
  <h3 class="title">Смотрите также</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.fread.php" class="function" rel="rdfs-seeAlso">fread()</a> - Читает файл в бинарно-безопасном режиме: как последовательность байтов</span></li>
    <li><span class="function"><a href="function.fgets.php" class="function" rel="rdfs-seeAlso">fgets()</a> - Получает строку из указателя на файл</span></li>
   </ul>
  </p>
 </div>


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