Voting

: min(four, four)?
(Example: nine)

The Note You're Voting On

chris at mad-teaparty dot com
22 years ago
Nice function. I did it the other way round:

function uncompress($srcName, $dstName) {
$zp = gzopen($srcName, "r");
while(!gzeof($zp))
$string .= gzread($zp, 4096);
gzclose($zp);

$fp = fopen($dstName, "w");
fwrite($fp, $string, strlen($string));
fclose($fp);
}

uncompress("./myfile.txt.gz", "./myfile.txt");

A shorter approach would be:

function uncompress($srcName, $dstName) {
$string = implode("", gzfile($srcName));
$fp = fopen($dstName, "w");
fwrite($fp, $string, strlen($string));
fclose($fp);
}

<< Back to user notes page

To Top