Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Closes an open file pointer
<?php fclose(resource $stream): bool
<?php     if ($chunk === '') {

        Loop::removeReadStream($stream);

        stream_set_blocking($stream, true);

        fclose($stream);

        return;

    }
<?php     if ($r === 0) {

        Loop::removeWriteStream($stdout);

        fclose($stdout);

        stream_set_blocking($stdout, true);

        fwrite(STDERR, 'Stopped because STDOUT closed' . PHP_EOL);
<?php     if ($chunk === '') {

        echo '[END]' . PHP_EOL;

        Loop::removeReadStream($stream);

        fclose($stream);

        return;

    }
<?php         if ($chunk === '') {

            echo '[END]' . PHP_EOL;

            Loop::removeReadStream($stream);

            fclose($stream);

            return;

        }
<?php     Loop::addWriteStream($conn, function ($conn) use (&$data) {

        $written = fwrite($conn, $data);

        if ($written === strlen($data)) {

            fclose($conn);

            Loop::removeWriteStream($conn);

        } else {

            $data = substr($data, $written);
<?php             $loop->cancelTimer($timeout);

        });



        fclose($output);



        $this->loop->run();
<?php         list ($input, $output) = $this->createSocketPair();



        fwrite($input, 'hello');

        fclose($input);



        $loop = $this->loop;

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

                $received .= 'X';

                $loop->removeReadStream($output);

                fclose($output);

            } else {

                $received .= '[' . $chunk . ']';

            }
<?php         $loop->addReadStream($stream, function ($stream) use ($loop) {

            $loop->removeReadStream($stream);

            $loop->removeWriteStream($stream);

            fclose($stream);

        });
<?php         });




        fclose($other);



        $this->assertRunFasterThan($this->tickTimeout);

    }
<?php             $loop->removeReadStream($stream);

            $loop->removeWriteStream($stream);

            fclose($stream);

        });
<?php         fwrite($other, str_repeat('.', static::PHP_DEFAULT_CHUNK_SIZE));

        $this->loop->addTimer(0.01, function () use ($other) {

            fclose($other);

        });



        $this->assertRunFasterThan(0.1);
<?php         $loop->addReadStream($stream, function ($stream) use ($loop) {

            $loop->removeReadStream($stream);

            $loop->removeWriteStream($stream);

            fclose($stream);

        });



        $this->assertRunFasterThan($this->tickTimeout);