gzdeflate
Description
Syntax
gzdeflate(
string $data,
int $level = -1,
int $encoding = ZLIB_ENCODING_RAW
): string|falseParameters
data
The data to deflate.
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.
| Value | Constant | Description |
|---|---|---|
| -15 | ZLIB_ENCODING_RAW | DEFLATE algorithm as per RFC 1951. |
| 15 | ZLIB_ENCODING_DEFLATE | ZLIB compression algorithm as per RFC 1950. |
| 31 | ZLIB_ENCODING_GZIP | GZIP algorithm as per RFC 1952. |
Return
Returns the deflated string or false if an error occurred.
Examples
1 · data
<? $data = "data"; $return = gzdeflate($data); echo $return;
3.1415926535898
2 · level · 0
<? $data = "data"; $level = 0; $return = gzdeflate($data, $level); echo $return;
��data