Source of: /manual/en/function.gzread.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.gzread.php',
1 => 'gzread',
),
'up' =>
array (
0 => 'ref.zlib.php',
1 => 'Zlib Functions',
),
'prev' =>
array (
0 => 'function.gzputs.php',
1 => 'gzputs',
),
'next' =>
array (
0 => 'function.gzrewind.php',
1 => 'gzrewind',
),
);
$setup["toc"] = $TOC;
$setup["parents"] = $PARENTS;
manual_setup($setup);
manual_header();
?>
<div id="function.gzread" class="refentry">
<div class="refnamediv">
<h1 class="refname">gzread</h1>
<p class="verinfo">(PHP 4, PHP 5)</p><p class="refpurpose"><span class="refname">gzread</span> — <span class="dc-title">Binary-safe gz-file read</span></p>
</div>
<a name="function.gzread.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>gzread</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">
<b>gzread()</b> reads up to <i><tt class="parameter">length</tt></i>
bytes
from the given gz-file pointer. Reading stops when
<i><tt class="parameter">length</tt></i>
(uncompressed) bytes have been read
or <acronym title="End Of File">EOF</acronym> is reached, whichever comes first.
</p>
</div>
<a name="function.gzread.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 number of bytes to read.
</p>
</dd>
</dl>
<p>
</p>
</div>
<a name="function.gzread.returnvalues"></a><div class="refsect1 returnvalues">
<h3 class="title">Return Values</h3>
<p class="para">
The data that have been read.
</p>
</div>
<a name="function.gzread.examples"></a><div class="refsect1 examples">
<h3 class="title">Examples</h3>
<p class="para">
</p><div class="example">
<p><b>Example #1 <b>gzread()</b> example</b></p>
<div class="example-contents programlisting">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB"><?php<br /></span><span style="color: #FF8000">// get contents of a gz-file into a string<br /></span><span style="color: #0000BB">$filename </span><span style="color: #007700">= </span><span style="color: #DD0000">"/usr/local/something.txt.gz"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$zd </span><span style="color: #007700">= </span><span style="color: #0000BB">gzopen</span><span style="color: #007700">(</span><span style="color: #0000BB">$filename</span><span style="color: #007700">, </span><span style="color: #DD0000">"r"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$contents </span><span style="color: #007700">= </span><span style="color: #0000BB">gzread</span><span style="color: #007700">(</span><span style="color: #0000BB">$zd</span><span style="color: #007700">, </span><span style="color: #0000BB">10000</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">gzclose</span><span style="color: #007700">(</span><span style="color: #0000BB">$zd</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?></span>
</span>
</code></div>
</div>
</div><p>
</p>
</div>
<a name="function.gzread.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.gzwrite.php" class="function" rel="rdfs-seeAlso">gzwrite()</a> - Binary-safe gz-file write</li>
<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.gzgets.php" class="function" rel="rdfs-seeAlso">gzgets()</a> - Get line from file pointer</li>
<li class="member"><a href="function.gzgetss.php" class="function" rel="rdfs-seeAlso">gzgetss()</a> - Get line from gz-file pointer and strip HTML tags</li>
<li class="member"><a href="function.gzfile.php" class="function" rel="rdfs-seeAlso">gzfile()</a> - Read entire gz-file into an array</li>
<li class="member"><a href="function.gzpassthru.php" class="function" rel="rdfs-seeAlso">gzpassthru()</a> - Output all remaining data on a gz-file pointer</li>
</ul><p>
</p>
</div>
</div><?php manual_footer(); ?>