fread

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

                    clearstatcache(true, $path);



                    $contents = fread($handle, $this->size($path) ?: 1);



                    flock($handle, LOCK_UN);

                }
<?php     {

        clearstatcache(true, $this->path);



        return fread($this->handle, $length ?? ($this->size() ?: 1));

    }
<?php         $contents = '';

        while (! feof($handle)) {

            $fread = fread($handle, 8192);

            assert($fread !== false);

            $contents .= $fread;

        }
<?php     {

        foreach ($streams as $paramNr => $stream) {

            while (! feof($stream)) {

                $chunk = fread($stream, 8192);



                if ($chunk === false) {

                    throw FailedReadingStreamOffset::new($paramNr);
<?php         $result = true;

        while (!feof($ah)) {

            if (fread($ah, 8192) != fread($bh, 8192)) {

                $result = false;

                break;

            }
<?php             $client = stream_socket_client('udp://8.8.8.8:53');

            fwrite($client, $request);

            $response = fread($client, 65536);



            stream_socket_sendto($socket, $response, 0, $peer);

            ++$received;
<?php Loop::addReadStream(STDIN, function ($stream) {

    $chunk = fread($stream, 64 * 1024);




    if ($chunk === '') {
<?php Loop::addReadStream($stream, function ($stream) {

    $chunk = fread($stream, 64 * 1024);




    if ($chunk === '') {
<?php     Loop::addReadStream($stream, function ($stream) {

        $chunk = fread($stream, 64 * 1024);




        if ($chunk === '') {
<?php         $loop = $this->loop;

        $received =& $this->received;

        $loop->addReadStream($output, function ($output) use ($loop, &$received) {

            $chunk = fread($output, 1024);

            if ($chunk === '') {

                $received .= 'X';

                $loop->removeReadStream($output);
<?php         $loop = $this->loop;

        $loop->addReadStream($stream, function ($stream) use ($loop) {

            $data = fread($stream, 1024);

            if ($data !== '') {

                return;

            }
<?php     fwrite($term, "\033[6n");

    fclose($term);



    $buf = fread(STDIN, 16);



    system("stty '$ttyprops'");
<?php         @fwrite($input, terminal()->getCsi() . '6n');



        $code = trim(fread($input, 1024));



        shell_exec(sprintf('stty %s', $sttyMode));