zlib extension¶
The zlib extension provides functions to handle the zlib compression format: read, write and access arbitrary part of files. It also provide a compression format for the output of PHP.
There is also a PHP wrapper for zlib, when the zlib extension is compiled: zlib://.
<?php
$lines = gzfile('somefile.gz');
foreach ($lines as $line) {
echo $line . PHP_EOL;
}
?>
See also Using zlib for Page Compression and Introducing streaming zlib compression and decompression with ReactPHP.
Related : zip Extension, bzip2 Extension, File, PHP Wrappers