gzuncompress()

gzuncompress() — Uncompress a compressed string.

Built-in function of PHP 8.5. The manual lists it as available in PHP 4 >= 4.0.1, PHP 5, PHP 7, PHP 8. This page is the reference card: signature, parameters and return value, plus the changelog and the example the manual provides.

Signature

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

Parameters

ParameterTypeWhat it takes
$datastringThe data compressed by gzcompress().
$max_lengthintThe maximum length of data to decode.

Return value

The original uncompressed data or false on error. The function will return an error if the uncompressed data is more than 32768 times the length of the compressed input data or more than the optional parameter max_length.

Example

A runnable snippet:

$compressed = gzcompress('Compress me', 9); $uncompressed = gzuncompress($compressed); echo $uncompressed;

See also

gzcompress(), gzinflate(), gzdeflate(), gzencode()

All PHP 8.5 built-in functions

Reference card built from the PHP manual page gzuncompress() (PHP documentation, CC BY 3.0). The page is generated from the manual, so the wording of the parameter and return value text follows php.net.