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

gzgetc

Description

The gzgetc of zlib for PHP gets a character from gz-file pointer.

Syntax

gzgetc(
    resource $stream
): string|false

Parameters

stream

The gz-file pointer. It must be valid, and must point to a file successfully opened by gzopen().

Return

Returns the uncompressed character or false on EOF (unlike gzeof()).

Examples

1 · stream

<?

$filename = $_SERVER["DOCUMENT_ROOT"] . "/assets/gz/1.gz";
$mode = "r";

$stream = gzopen($filename, $mode);

    if($stream === false)
    {
        die("gzopen");
    }

    while(!gzeof($stream))
    {
        $return = gzgetc($stream);

        echo $return . PHP_EOL;
    }

gzclose($stream);

?>
d
a
t
a

HomeMenu