Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Binary-safe file write
Alias fputs
<?php fwrite(resource $stream, string $data, ?int $length = null): int|false
<?php     public function write($contents)

    {

        fwrite($this->handle, $contents);



        fflush($this->handle);
<?php             default => $output,

        };



        fwrite($this->outputStream, $output);



        $this->dumping = false;

    }
<?php                 return;

            }



            fwrite($sink, $body);

            rewind($sink);

        };

    }
<?php     {

        $tmpfile = tmpfile();



        fwrite($tmpfile, $content);



        return tap(new File($name, $tmpfile), function ($file) use ($tmpfile) {

            $file->sizeToReport = fstat($tmpfile)['size'];
<?php             call_user_func($functionName, $image);



            fwrite($temp, ob_get_clean());

        });

    }

}
<?php         $this->assertFalse($disk->prepend('path.txt', 'data'));

        $this->assertFalse($disk->append('path.txt', 'data'));

        $handle = fopen('php://memory', 'rw');

        fwrite($handle, 'content');

        $this->assertFalse($disk->writeStream('path.txt', $handle));

        fclose($handle);
<?php     {

        $string = 'Look at me, i am a stream!!';

        $resource = fopen('php://temp', 'w');

        fwrite($resource, $string);

        rewind($resource);

        $body = Utils::streamFor($resource);
<?php         $response = TestResponse::fromBaseResponse(

            new StreamedResponse(function () {

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

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

                rewind($stream);

                fpassthru($stream);

            })