PHP.nl

gzcompress

gzcompress

Compress a string

 **gzcompress** string $data int $level int $encoding

This function compresses the given string using the data format. ZLIB

For details on the ZLIB compression algorithm see the document "" (RFC 1950). ZLIB Compressed Data Format Specification version 3.3

Opmerking: > This is the same as gzip compression, which includes some header data. See for gzip compression. notgzencode

dataThe data to compress.

levelThe 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 One of constants. ZLIB_ENCODING_*

The compressed string or false if an error occurred.

Voorbeeld: example

<?php
$compressed = gzcompress('Compress me', 9);
echo $compressed;
?>

gzdeflate``gzinflate``gzuncompress``gzencode