Sophie

Sophie

distrib > Mageia > 4 > i586 > by-pkgid > f800694edefe91adea2624f711a41a2d > files > 12058

php-manual-en-5.5.7-1.mga4.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Read from stream</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="streamwrapper.stream-open.html">streamWrapper::stream_open</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="streamwrapper.stream-seek.html">streamWrapper::stream_seek</a></div>
 <div class="up"><a href="class.streamwrapper.html">streamWrapper</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><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)</p><p class="refpurpose"><span class="refname">streamWrapper::stream_read</span> &mdash; <span class="dc-title">Read from stream</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-streamwrapper.stream-read-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">string</span> <span class="methodname"><strong>streamWrapper::stream_read</strong></span>
    ( <span class="methodparam"><span class="type">int</span> <code class="parameter">$count</code></span>
   )</div>

  <p class="para rdfs-comment">
   This method is called in response to  <span class="function"><a href="function.fread.html" class="function">fread()</a></span>
   and  <span class="function"><a href="function.fgets.html" class="function">fgets()</a></span>.
  </p>
  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <p class="para">
    Remember to update the read/write position of the stream (by the number of
    bytes that were successfully read).
   </p>
  </p></blockquote>

 </div>


 <div class="refsect1 parameters" id="refsect1-streamwrapper.stream-read-parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">
   <dl>

    <dt>

     <span class="term"><em><code class="parameter">count</code></em></span>
     <dd>

      <p class="para">
       How many bytes of data from the current position should be returned.
      </p>
     </dd>

    </dt>

   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-streamwrapper.stream-read-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   If there are less than <em><code class="parameter">count</code></em>
   bytes available, return as many as are available.  If no
   more data is available, return either <strong><code>FALSE</code></strong> or an
   empty string.
  </p>
 </div>


 <div class="refsect1 errors" id="refsect1-streamwrapper.stream-read-errors">
  <h3 class="title">Errors/Exceptions</h3>
  <p class="para">Emits
<strong><code>E_WARNING</code></strong> if call to this method fails
(i.e. not implemented).</p>
  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <p class="para">
    If the return value is longer then <em><code class="parameter">count</code></em> an
    <strong><code>E_WARNING</code></strong> error will be emitted, and excess data will be
    lost.
   </p>
  </p></blockquote>
 </div>

 



 <div class="refsect1 notes" id="refsect1-streamwrapper.stream-read-notes">
  <h3 class="title">Notes</h3>
  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <p class="para">
     <span class="methodname"><a href="streamwrapper.stream-eof.html" class="methodname">streamWrapper::stream_eof()</a></span> is called directly after
    calling  <span class="methodname"><strong>streamWrapper::stream_read()</strong></span> to check if
    <acronym title="End Of File">EOF</acronym> has been reached. If not implemented,
    <acronym title="End Of File">EOF</acronym> is assumed.
   </p>
  </p></blockquote>
  <div class="warning"><strong class="warning">Warning</strong>
    <p class="para">
      When reading the whole file (for example, with
       <span class="function"><a href="function.file-get-contents.html" class="function">file_get_contents()</a></span>), PHP will call
       <span class="methodname"><strong>streamWrapper::stream_read()</strong></span> followed by        
       <span class="methodname"><a href="streamwrapper.stream-eof.html" class="methodname">streamWrapper::stream_eof()</a></span> in a loop but as long    
      as  <span class="methodname"><strong>streamWrapper::stream_read()</strong></span> returns a
      non-empty string, the return value of
       <span class="methodname"><a href="streamwrapper.stream-eof.html" class="methodname">streamWrapper::stream_eof()</a></span> is ignored.
    </p>
  </div>
 </div>

 
 <div class="refsect1 seealso" id="refsect1-streamwrapper.stream-read-seealso">
  <h3 class="title">See Also</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"> <span class="function"><a href="function.fread.html" class="function" rel="rdfs-seeAlso">fread()</a> - Binary-safe file read</span></li>
    <li class="member"> <span class="function"><a href="function.fgets.html" class="function" rel="rdfs-seeAlso">fgets()</a> - Gets line from file pointer</span></li>
   </ul>
  </p>
 </div>


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="streamwrapper.stream-open.html">streamWrapper::stream_open</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="streamwrapper.stream-seek.html">streamWrapper::stream_seek</a></div>
 <div class="up"><a href="class.streamwrapper.html">streamWrapper</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>