Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Rewind the position of a file pointer
<?php rewind(resource $stream): bool
<?php     public function truncate()

    {

        rewind($this->handle);



        ftruncate($this->handle, 0);
<?php             }



            fwrite($sink, $body);

            rewind($sink);

        };

    }
<?php         $string = 'Look at me, i am a stream!!';

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

        fwrite($resource, $string);

        rewind($resource);

        $body = Utils::streamFor($resource);



        $fakeRequest = function (Request $request) use ($string) {
<?php             new StreamedResponse(function () {

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

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

                rewind($stream);

                fpassthru($stream);

            })

        );