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.gzwrite.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.gzwrite.php',
   
1 => 'gzwrite',
  ),
 
'up' =>
  array (
   
0 => 'ref.zlib.php',
   
1 => 'Zlib Functions',
  ),
 
'prev' =>
  array (
   
0 => 'function.gzuncompress.php',
   
1 => 'gzuncompress',
  ),
 
'next' =>
  array (
   
0 => 'function.readgzfile.php',
   
1 => 'readgzfile',
  ),
);
$setup["toc"] = $TOC;
$setup["parents"] = $PARENTS;
manual_setup($setup);

manual_header();
?>
<div id="function.gzwrite" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">gzwrite</h1>
  <p class="verinfo">(PHP 4, PHP 5)</p><p class="refpurpose"><span class="refname">gzwrite</span> &mdash; <span class="dc-title">Binary-safe gz-file write</span></p>

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

  <p class="para rdfs-comment">
   <b>gzwrite()</b> writes the contents of
   <i><tt class="parameter">string</tt></i>
 to the given gz-file.
  </p>
 </div>

 <a name="function.gzwrite.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">string</tt></i>
</span>

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

      <p class="para">
       The string to write.
      </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 uncompressed bytes to write. If supplied, writing will
       stop after <i><tt class="parameter">length</tt></i>
 (uncompressed) bytes have been
       written or the end of <i><tt class="parameter">string</tt></i>
 is reached,
       whichever comes first.
      </p>
      <blockquote><p><b class="note">Note</b>:
      
        Note that if the <i><tt class="parameter">length</tt></i>
 argument is given,
        then the <a href="info.configuration.php#ini.magic-quotes-runtime" class="link">magic_quotes_runtime</a>
        configuration option will be ignored and no slashes will be
        stripped from <i><tt class="parameter">string</tt></i>
.
       <br />
      </p></blockquote>
     </dd>

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

 <a name="function.gzwrite.returnvalues"></a><div class="refsect1 returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   Returns the number of (uncompressed) bytes written to the given gz-file
   stream.
  </p>
 </div>

 <a name="function.gzwrite.examples"></a><div class="refsect1 examples">
  <h3 class="title">Examples</h3>
  <p class="para">
   </p><div class="example">
    <p><b>Example #1 <b>gzwrite()</b> example</b></p>
    <div class="example-contents programlisting">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$string&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'Some&nbsp;information&nbsp;to&nbsp;compress'</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$gz&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">,</span><span style="color: #DD0000">'w9'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">gzwrite</span><span style="color: #007700">(</span><span style="color: #0000BB">$gz</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$string</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">gzclose</span><span style="color: #007700">(</span><span style="color: #0000BB">$gz</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

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

 <a name="function.gzwrite.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.gzread.php" class="function" rel="rdfs-seeAlso">gzread()</a> - Binary-safe gz-file read</li>
    <li class="member"><a href="function.gzopen.php" class="function" rel="rdfs-seeAlso">gzopen()</a> - Open gz-file</li>
   </ul><p>
  </p>
 </div>

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