◐ Shell
clean mode source ↗

PHP: zlib_encode - Manual

(PHP 5 >= 5.4.0, PHP 7, PHP 8)

zlib_encodeCompress data with the specified encoding

Description

Warning

This function is currently not documented; only its argument list is available.

Return Values

Examples

Example #1 zlib_encode() example

<?php
$str = 'hello world';
$enc = zlib_encode($str, ZLIB_ENCODING_DEFLATE);
echo bin2hex($enc);
?>

The above example will output:

789ccb48cdc9c95728cf2fca4901001a0b045d

See Also

Found A Problem?

geniuszxy at outlook dot com

3 years ago

zlib_encode, gzcompress, gzdeflate and gzencode are the same functions besides the parameter order.

zlib_encode + ZLIB_ENCODING_RAW = gzdeflate
zlib_encode + ZLIB_ENCODING_DEFLATE = gzcompress
zlib_encode + ZLIB_ENCODING_GZIP = gzencode