Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

zlib_decode

Description

The zlib_decode of zlib for PHP uncompresses any raw/gzip/zlib encoded data.

Syntax

zlib_decode(
    string $data,
    int $max_length = 0
): string|false

Parameters

data

The data compressed by zlib_encode().

max_length

The maximum length of decoded data.

Return

Returns the uncompressed data, or false on failure.

Returns an error if the uncompressed data is more than 32768 times the length of the compressed input data or, unless max_length is 0, more than max_length.

Examples

1 · data

<?

$zlib_encodedata = "data";
$zlib_encodeencoding = ZLIB_ENCODING_DEFLATE;

$data = zlib_encode($zlib_encodedata, $zlib_encodeencoding);

echo $data . PHP_EOL;

$return = zlib_decode($data);

echo $return;

?>
x�KI,I�
data

2 · max_length

<?

$zlib_encodedata = "data";
$zlib_encodeencoding = ZLIB_ENCODING_DEFLATE;

$data = zlib_encode($zlib_encodedata, $zlib_encodeencoding);

echo $data . PHP_EOL;

$max_length = 2;

$return = zlib_decode($data, $max_length);

var_export($return);

?>
x�KI,I�
false
HomeMenu