note 100163 deleted from function.gzdecode by danbrown
| From: | danbrown@php.net | Date: | Wed, 29 Sep 2010 01:48:17 +0000 |
| Subject: | note 100163 deleted from function.gzdecode by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-172794@lists.php.net to get a copy of this message | ||
Note Submitter: Dave B
----
yet another version... tried to keep it simple. the catch is that it's already expected to be
in a file. Works similar to file_get_contents and should be thread-safe.
<?php
//custom version of the gzdecode string
function gzfile_get_contents($filename)
{
$h = gzopen($filename,'r');
while($tempdata = gzread($h,1024*1024*2)) //read 2 MB at a time
{
$data .= $tempdata;
}
gzclose($h);
return $data;
}
?>