downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

Our source is open

The syntax highlighted source is automatically generated by PHP from the plaintext script. If you're interested in what's behind the several functions we used, you can always take a look at the source of the following files:

Of course, if you want to see the source of this page, we have it available. You can also browse the SVN repository for this website on svn.php.net.

Source of: /manual/en/function.gzgets.php

<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$PARENTS = array();
include_once
dirname(__FILE__) ."/toc/ref.zlib.inc";
$setup = array (
 
'home' =>
  array (
   
0 => 'index.php',
   
1 => 'PHP Manual',
  ),
 
'head' =>
  array (
   
0 => 'UTF-8',
   
1 => 'en',
  ),
 
'this' =>
  array (
   
0 => 'function.gzgets.php',
   
1 => 'gzgets',
  ),
 
'up' =>
  array (
   
0 => 'ref.zlib.php',
   
1 => 'Zlib Functions',
  ),
 
'prev' =>
  array (
   
0 => 'function.gzgetc.php',
   
1 => 'gzgetc',
  ),
 
'next' =>
  array (
   
0 => 'function.gzgetss.php',
   
1 => 'gzgetss',
  ),
);
$setup["toc"] = $TOC;
$setup["parents"] = $PARENTS;
manual_setup($setup);

manual_header();
?>
<div id="function.gzgets" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">gzgets</h1>
  <p class="verinfo">(PHP 4, PHP 5)</p><p class="refpurpose"><span class="refname">gzgets</span> &mdash; <span class="dc-title">Get line from file pointer</span></p>

 </div>
 <a name="function.gzgets.description"></a><div class="refsect1 description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">string</span> <span class="methodname"><b>gzgets</b></span>
    ( <span class="methodparam"><span class="type">resource</span> <tt class="parameter">$zp</tt></span>
   , <span class="methodparam"><span class="type">int</span> <tt class="parameter">$length</tt></span>
   )</div>

  <p class="para rdfs-comment">
   Gets a (uncompressed) string of up to length - 1 bytes read from the given
   file pointer. Reading ends when length - 1 bytes have been read, on a
   newline, or on EOF (whichever comes first).
  </p>
 </div>

 <a name="function.gzgets.parameters"></a><div class="refsect1 parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">
   </p><dl>

    <dt class="varlistentry">

     <span class="term"><i><tt class="parameter">zp</tt></i>
</span>

     </dt><dd class="listitem">

      <p class="para">
       The gz-file pointer. It must be valid, and must point to a file
       successfully opened by <a href="function.gzopen.php" class="function">gzopen()</a>.
      </p>
     </dd>

   
    <dt class="varlistentry">

     <span class="term"><i><tt class="parameter">length</tt></i>
</span>

     </dt><dd class="listitem">

      <p class="para">
       The length of data to get.
      </p>
     </dd>

   
   </dl>
<p>
  </p>
 </div>

 <a name="function.gzgets.returnvalues"></a><div class="refsect1 returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   The uncompressed string, or <b><tt class="constant">FALSE</tt></b> on error.
  </p>
 </div>

 <a name="function.gzgets.examples"></a><div class="refsect1 examples">
  <h3 class="title">Examples</h3>
  <p class="para">
   </p><div class="example">
    <p><b>Example #1 <b>gzgets()</b> example</b></p>
    <div class="example-contents programlisting">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$handle&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">gzopen</span><span style="color: #007700">(</span><span style="color: #DD0000">'somefile.gz'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'r'</span><span style="color: #007700">);<br />while&nbsp;(!</span><span style="color: #0000BB">gzeof</span><span style="color: #007700">(</span><span style="color: #0000BB">$handle</span><span style="color: #007700">))&nbsp;{<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$buffer&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">gzgets</span><span style="color: #007700">(</span><span style="color: #0000BB">$handle</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">4096</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #0000BB">$buffer</span><span style="color: #007700">;<br />}<br /></span><span style="color: #0000BB">gzclose</span><span style="color: #007700">(</span><span style="color: #0000BB">$handle</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

   </div><p>
  </p>
 </div>

 <a name="function.gzgets.seealso"></a><div class="refsect1 seealso">
  <h3 class="title">See Also</h3>
  <p class="para">
   </p><ul class="simplelist">
    <li class="member"><a href="function.gzopen.php" class="function" rel="rdfs-seeAlso">gzopen()</a> - Open gz-file</li>
    <li class="member"><a href="function.gzgetc.php" class="function" rel="rdfs-seeAlso">gzgetc()</a> - Get character from gz-file pointer</li>
    <li class="member"><a href="function.gzwrite.php" class="function" rel="rdfs-seeAlso">gzwrite()</a> - Binary-safe gz-file write</li>
   </ul><p>
  </p>
 </div>

</div><?php manual_footer(); ?>
 
show source | credits | sitemap | contact | advertising | mirror sites