<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.phar.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'de',
  ),
  'this' => 
  array (
    0 => 'phar.cancompress.php',
    1 => 'Phar::canCompress',
    2 => 'Returns whether phar extension supports compression using either zlib or bzip2',
  ),
  'up' => 
  array (
    0 => 'class.phar.php',
    1 => 'Phar',
  ),
  'prev' => 
  array (
    0 => 'phar.buildfromiterator.php',
    1 => 'Phar::buildFromIterator',
  ),
  'next' => 
  array (
    0 => 'phar.canwrite.php',
    1 => 'Phar::canWrite',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/phar/Phar/canCompress.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="phar.cancompress" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">Phar::canCompress</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.3.0, PHP 7, PHP 8, PECL phar &gt;= 1.0.0)</p><p class="refpurpose"><span class="refname">Phar::canCompress</span> &mdash; <span class="dc-title">Returns whether phar extension supports compression using either zlib or bzip2</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-phar.cancompress-description">
  <h3 class="title">Beschreibung</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">final</span> <span class="modifier">public</span> <span class="modifier">static</span> <span class="methodname"><strong>Phar::canCompress</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$compression</code><span class="initializer"> = 0</span></span>): <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></div>


  <p class="para rdfs-comment">
   This should be used to test whether compression is possible prior to
   loading a phar archive containing compressed files.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-phar.cancompress-parameters">
  <h3 class="title">Parameter-Liste</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">compression</code></dt>
     <dd>
      <p class="para">
       Either <code class="literal">Phar::GZ</code> or <code class="literal">Phar::BZ2</code> can be
       used to test whether compression is possible with a specific compression
       algorithm (zlib or bzip2).
      </p>
     </dd>
    
   </dl>
  </p>
 </div>

 <div class="refsect1 returnvalues" id="refsect1-phar.cancompress-returnvalues">
  <h3 class="title">Rückgabewerte</h3>
  <p class="para">
   <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong> if compression/decompression is available, <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> if not.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-phar.cancompress-examples">
  <h3 class="title">Beispiele</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Beispiel #1 A <span class="function"><strong>Phar::canCompress()</strong></span> example</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">if (</span><span style="color: #0000BB">Phar</span><span style="color: #007700">::</span><span style="color: #0000BB">canCompress</span><span style="color: #007700">()) {<br />    echo </span><span style="color: #0000BB">file_get_contents</span><span style="color: #007700">(</span><span style="color: #DD0000">'phar://compressedphar.phar/internal/file.txt'</span><span style="color: #007700">);<br />} else {<br />    echo </span><span style="color: #DD0000">'no compression available'</span><span style="color: #007700">;<br />}<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

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


 <div class="refsect1 seealso" id="refsect1-phar.cancompress-seealso">
  <h3 class="title">Siehe auch</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="pharfileinfo.getcompressedsize.php" class="function" rel="rdfs-seeAlso">PharFileInfo::getCompressedSize()</a> - Returns the actual size of the file (with compression) inside the Phar archive</span></li>
    <li><span class="function"><a href="pharfileinfo.iscompressed.php" class="function" rel="rdfs-seeAlso">PharFileInfo::isCompressed()</a> - Returns whether the entry is compressed</span></li>
    <li><span class="function"><a href="pharfileinfo.compress.php" class="function" rel="rdfs-seeAlso">PharFileInfo::compress()</a> - Compresses the current Phar entry with either zlib or bzip2 compression</span></li>
    <li><span class="function"><a href="pharfileinfo.decompress.php" class="function" rel="rdfs-seeAlso">PharFileInfo::decompress()</a> - Decompresses the current Phar entry within the phar</span></li>
    <li><span class="function"><a href="phar.iscompressed.php" class="function" rel="rdfs-seeAlso">Phar::isCompressed()</a> - Returns Phar::GZ or PHAR::BZ2 if the entire phar archive is compressed (.tar.gz/tar.bz and so on)</span></li>
    <li><span class="function"><a href="phar.compressfiles.php" class="function" rel="rdfs-seeAlso">Phar::compressFiles()</a> - Compresses all files in the current Phar archive</span></li>
    <li><span class="function"><a href="phar.decompressfiles.php" class="function" rel="rdfs-seeAlso">Phar::decompressFiles()</a> - Decompresses all files in the current Phar archive</span></li>
    <li><span class="function"><a href="phar.getsupportedcompression.php" class="function" rel="rdfs-seeAlso">Phar::getSupportedCompression()</a> - Return array of supported compression algorithms</span></li>
    <li><span class="function"><a href="phar.converttoexecutable.php" class="function" rel="rdfs-seeAlso">Phar::convertToExecutable()</a> - Convert a phar archive to another executable phar archive file format</span></li>
    <li><span class="function"><a href="phar.converttodata.php" class="function" rel="rdfs-seeAlso">Phar::convertToData()</a> - Convert a phar archive to a non-executable tar or zip file</span></li>
   </ul>
  </p>
 </div>



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