gzread

Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Binary-safe gz-file read
<?php gzread(resource $stream, int $length): string|false
<?php     {

        $archiveFile = gzopen($file, 'rb');

        $targetFile = fopen($targetFilepath, 'wb');

        while ($string = gzread($archiveFile, 4096)) {

            fwrite($targetFile, $string, Platform::strlen($string));

        }

        gzclose($archiveFile);