fpassthru

Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Output all remaining data on a file pointer
<?php fpassthru(resource $stream): int
<?php         $response->setCallback(function () use ($path) {

            $stream = $this->readStream($path);

            fpassthru($stream);

            fclose($stream);

        });
<?php                 $stream = fopen('php://memory', 'r+');

                fwrite($stream, 'expected response data');

                rewind($stream);

                fpassthru($stream);

            })

        );
<?php         $stream = $filesystem->readStream($file);



        return response()->stream(function () use ($stream) {

            fpassthru($stream);

        }, 200, [

            'Content-Type' => $filesystem->getMimetype($file),

            'Content-Length' => $filesystem->getSize($file),
<?php             if (ftell($stream) !== 0) {

                rewind($stream);

            }

            fpassthru($stream);

            fclose($stream);

        });
<?php if (isset($_GET['img'])) {

    $fp = fopen('https://bref.sh/img/logo-small.png', 'rb');

    header('Content-Type: image/png');

    fpassthru($fp);

    exit(0);

}