<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = 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 => 'fr',
  ),
  'this' => 
  array (
    0 => 'function.gzwrite.php',
    1 => 'gzwrite',
    2 => '&Eacute;crit dans un fichier compress&eacute; gzip',
  ),
  'up' => 
  array (
    0 => 'ref.zlib.php',
    1 => 'Fonctions Zlib',
  ),
  'prev' => 
  array (
    0 => 'function.gzuncompress.php',
    1 => 'gzuncompress',
  ),
  'next' => 
  array (
    0 => 'function.inflate-add.php',
    1 => 'inflate_add',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'fr',
    'path' => 'reference/zlib/functions/gzwrite.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.gzwrite" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">gzwrite</h1>
  <p class="verinfo">(PHP 4, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">gzwrite</span> &mdash; <span class="dc-title">Écrit dans un fichier compressé gzip</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.gzwrite-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>gzwrite</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.resource.php" class="type resource">resource</a></span> <code class="parameter">$stream</code></span>, <span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$data</code></span>, <span class="methodparam"><span class="type"><span class="type"><a href="language.types.null.php" class="type null">?</a></span><span class="type"><a href="language.types.integer.php" class="type int">int</a></span></span> <code class="parameter">$length</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong></span></span>): <span class="type"><span class="type"><a href="language.types.integer.php" class="type int">int</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"><strong>gzwrite()</strong></span> écrit le contenu de la chaîne
   <code class="parameter">data</code> dans le fichier compressé
   <code class="parameter">zp</code>.
  </p>
 </div>

 <div class="refsect1 parameters" id="refsect1-function.gzwrite-parameters">
  <h3 class="title">Liste de paramètres</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">stream</code></dt>
     <dd>
      <p class="para">
       Le pointeur de fichier. Il doit être valide et doit pointer vers un
       fichier ouvert avec succès grâce à la fonction <span class="function"><a href="function.gzopen.php" class="function">gzopen()</a></span>.
      </p>
     </dd>
    
    
     <dt><code class="parameter">data</code></dt>
     <dd>
      <p class="para">
       La chaîne à écrire.
      </p>
     </dd>
    
    
     <dt><code class="parameter">length</code></dt>
     <dd>
      <p class="para">
       Le nombre d&#039;octets décompressés à écrire. Si fournie, l&#039;écriture
       s&#039;arrêtera après <code class="parameter">length</code> (décompressé) octets écrits
       ou si la fin de la chaîne <code class="parameter">data</code> est atteinte ;
       celui qui survient le premier.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>

 <div class="refsect1 returnvalues" id="refsect1-function.gzwrite-returnvalues">
  <h3 class="title">Valeurs de retour</h3>
  <p class="para">
   Retourne le nombre d&#039;octets (décompressés) écrits dans le flux gz
   donné,  ou <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> si une erreur survient.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.gzwrite-changelog">
  <h3 class="title">Historique</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>Version</th>
      <th>Description</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
      <td>8.0.0</td>
      <td>
       <code class="parameter">length</code> est désormais nullable; auparavant la valeur
       par défaut était <code class="literal">0</code>.
      </td>
     </tr>

     <tr>
      <td>7.4.0</td>
      <td>
       Cette fonction retourne désormais <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> en cas d&#039;échec; auparavant
       <code class="literal">0</code> était retourné.
      </td>
     </tr>

    </tbody>
   
  </table>

 </div>


 <div class="refsect1 examples" id="refsect1-function.gzwrite-examples">
  <h3 class="title">Exemples</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Exemple #1 Exemple avec <span class="function"><strong>gzwrite()</strong></span></strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$string </span><span style="color: #007700">= </span><span style="color: #DD0000">'Quelques informations à compresser'</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$gz </span><span style="color: #007700">= </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">, </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>
 </div>

 <div class="refsect1 seealso" id="refsect1-function.gzwrite-seealso">
  <h3 class="title">Voir aussi</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.gzread.php" class="function" rel="rdfs-seeAlso">gzread()</a> - Lecture de fichier compress&eacute; binaire</span></li>
    <li><span class="function"><a href="function.gzopen.php" class="function" rel="rdfs-seeAlso">gzopen()</a> - Ouvre un fichier compress&eacute; avec gzip</span></li>
   </ul>
  </p>
 </div>

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