gzencode
Description
string gzencode ( string data [, int level [, int encoding_mode]])This function returns a compressed version of the input data compatible with the output of the gzip program, or FALSE if an error is encountered. The optional parameter level can be given as 0 for no compression up to 9 for maximum compression, if not given the default compression level will be the default compression level of the zlib library.
You can also give FORCE_GZIP (the default) or FORCE_DEFLATE as optional third paramter encoding_mode. If you use FORCE_DEFLATE, you get a standard zlib deflated string (inclusive zlib headers) after the gzip file header but without the trailing crc32 checksum.
Note: level was added in PHP 4.2, before PHP 4.2 gzencode() only had the data and (optional) encoding_mode parameters..
The resulting data contains the appropriate headers and data structure to make a standard .gz file, e.g.:
For more information on the GZIP file format, see the document: GZIP file format specification version 4.3 (RFC 1952).
See also gzcompress(). gzuncompress(), gzdeflate(), gzinflate().