Any Php Class To Decode/Incode Strings with Gzip, compress, x-gzip or x-compress Algorithm .
Thanks
Any Php Class To Decode/Incode Strings with Gzip, compress, x-gzip or x-compress Algorithm .
Thanks
See in the manual: PHP: Compression and Archive functions
and there specifically: ZLib functions, e.g. gzcompress()
They require the ZLib module to be present.
If you just need a generic wrapper to decode based on a given method name, use an array instead:
$decode = array(
"gzip" => "gzdecode",
"deflate" => "gzinflate",
"compress" => "gzuncompress",
"x-gzip" => "gzdecode",
"x-deflate" => "gzinflate",
"x-compress" => "gzuncompress",
);
Then instead of decode($bin, "x-gzip") you just use:
$uncompressed = $decode["x-gzip"]($bin_data);
Though I wonder about the use case. And maybe you'll better wrap it in a function.. :}