<?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 => 'ja',
  ),
  'this' => 
  array (
    0 => 'function.gzwrite.php',
    1 => 'gzwrite',
    2 => 'バイナリセーフな gz ファイル書き込み',
  ),
  'up' => 
  array (
    0 => 'ref.zlib.php',
    1 => 'Zlib 関数',
  ),
  'prev' => 
  array (
    0 => 'function.gzuncompress.php',
    1 => 'gzuncompress',
  ),
  'next' => 
  array (
    0 => 'function.inflate-add.php',
    1 => 'inflate_add',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'ja',
    '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">バイナリセーフな gz ファイル書き込み</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.gzwrite-description">
  <h3 class="title">説明</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> は <code class="parameter">data</code>
   の内容を与えられた gz ファイルに書き込みます。
  </p>
 </div>

 <div class="refsect1 parameters" id="refsect1-function.gzwrite-parameters">
  <h3 class="title">パラメータ</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">stream</code></dt>
     <dd>
      <p class="para">
       gz ファイルポインタを指定します。これは有効なファイルポインタであり、
       かつ、<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">
       書き込む文字列を指定します。
      </p>
     </dd>
    
    
     <dt><code class="parameter">length</code></dt>
     <dd>
      <p class="para">
       書き込む解凍されたバイト数を指定します。
       もし指定された場合、
       <code class="parameter">length</code> バイトのデータが書き込まれたか、
       <code class="parameter">data</code> の終わりに達した時に
       書き込みは終了します。
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.gzwrite-changelog">
  <h3 class="title">変更履歴</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>バージョン</th>
      <th>説明</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
      <td>8.0.0</td>
      <td>
       <code class="parameter">length</code> は、nullable になりました。
       これより前のバージョンでは、デフォルト値は <code class="literal">0</code> でした。
      </td>
     </tr>

     <tr>
      <td>7.4.0</td>
      <td>
       この関数は、失敗時に <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> を返すようになりました。
       これより前のバージョンでは、<code class="literal">0</code> を返していました。
      </td>
     </tr>

    </tbody>
   
  </table>

 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.gzwrite-returnvalues">
  <h3 class="title">戻り値</h3>
  <p class="para">
   与えられた gz ファイルストリームに書き込まれた (解凍された)
   バイト数を返します。失敗した場合に <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> を返します
  </p>
 </div>

 <div class="refsect1 examples" id="refsect1-function.gzwrite-examples">
  <h3 class="title">例</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>例1 <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">'Some information to compress'</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">参考</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.gzread.php" class="function" rel="rdfs-seeAlso">gzread()</a> - バイナリ対応のgzファイル読み込み</span></li>
    <li><span class="function"><a href="function.gzopen.php" class="function" rel="rdfs-seeAlso">gzopen()</a> - gz ファイルを開く</span></li>
   </ul>
  </p>
 </div>

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