gzcompress
Description
The gzcompress of zlib for PHP compresses a string.
Syntax
gzcompress( string $data, int $level = -1, int $encoding = ZLIB_ENCODING_DEFLATE ): string|false
Parameters
data
The data to compress.
level
The level of compression.
Can be given as 0 for no compression up to 9 for maximum compression. If -1 is used, the default compression of the zlib library is used which is 6.
encoding
The encoding mode.
Constant | Description |
---|---|
ZLIB_ENCODING_RAW | DEFLATE algorithm as per RFC 1951. |
ZLIB_ENCODING_DEFLATE | ZLIB compression algorithm as per RFC 1950. |
ZLIB_ENCODING_GZIP | GZIP algorithm as per RFC 1952. |
Return
Returns the compressed string or false if an error occurred.
Examples
1 · data
<? $data = "data"; $return = gzcompress($data); echo $return; ?>
x�KI,I �