readgzfile()
readgzfile() — Output a gz-file.
Built-in function of PHP 8.5. The manual lists it as available in PHP 4, 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.
What it does
Reads a file, decompresses it and writes it to standard output.
Signature
readgzfile(string $filename, bool $use_include_path = false): int|false
Parameters
| Parameter | Type | What it takes |
|---|---|---|
| $filename | string | The file name. This file will be opened from the filesystem and its contents written to standard output. |
| $use_include_path | bool | When set to true the include_path will be used to determine which file to open. |
Return value
Returns the number of (uncompressed) bytes read from the file on success, or false on failure
Example
The PHP manual ships no example for readgzfile(); the signature and the parameter table above are the contract.
Changelog
| Version | Change |
|---|---|
| 8.5.0 | use_include_path is now of type bool. Previously, it was of type int. |
See also
gzpassthru(), gzfile(), gzopen()
All PHP 8.5 built-in functions
Reference card built from the PHP manual page readgzfile() (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.