Warning: include_once(/home/theraven/sites/theraven7.com/php/manual/en/toc/class.phar.inc) [function.include-once]: failed to open stream: No such file or directory in /home/theraven/sites/theraven7.com/php/manual/en/phar.cancompress.php on line 5

Warning: include_once() [function.include]: Failed opening '/home/theraven/sites/theraven7.com/php/manual/en/toc/class.phar.inc' for inclusion (include_path='.:/usr/local/lib/php:/usr/local/php5/lib/pear') in /home/theraven/sites/theraven7.com/php/manual/en/phar.cancompress.php on line 5
PHP: Phar::canCompress - Manual
downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

Phar::canWrite> <Phar::buildFromIterator
[edit] Last updated: Fri, 18 May 2012

view this page in

Phar::canCompress

(PHP >= 5.3.0, PECL phar >= 1.0.0)

Phar::canCompressReturns whether phar extension supports compression using either zlib or bzip2

Description

bool Phar::canCompress ([ int $type = 0 ] )

This should be used to test whether compression is possible prior to loading a phar archive containing compressed files.

Parameters

type

Either Phar::GZ or Phar::BZ2 can be used to test whether compression is possible with a specific compression algorithm (zlib or bzip2).

Return Values

TRUE if compression/decompression is available, FALSE if not.

Examples

Example #1 A Phar::canCompress() example

<?php
if (Phar::canCompress()) {
    echo 
file_get_contents('phar://compressedphar.phar/internal/file.txt');
} else {
    echo 
'no compression available';
}
?>

See Also



add a note add a note User Contributed Notes Phar::canCompress
There are no user contributed notes for this page.

 
show source | credits | sitemap | contact | advertising | mirror sites