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

    $stream = fopen('php://temp', 'w+b');

    fwrite($stream, $contents);

    rewind($stream);



    return $stream;

}
<?php     private function rewindStream($resource): void

    {

        if (ftell($resource) !== 0 && stream_get_meta_data($resource)['seekable']) {

            rewind($resource);

        }

    }

}
<?php         try {

            $writeStream = fopen('php://temp', 'w+b');

            fwrite($writeStream, $contents);

            rewind($writeStream);

            $this->writeStream($path, $writeStream, $config);

        } finally {

            isset($writeStream) && is_resource($writeStream) && fclose($writeStream);
<?php             throw UnableToReadFile::fromLocation($path);

        }



        rewind($stream);



        return $stream;

    }
<?php         $stream = fopen('php://temp', 'w+b');

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

        rewind($stream);



        return $stream;

    }
<?php             throw UnableToReadFile::fromLocation($path);

        }



        rewind($readStream);



        return $readStream;

    }
<?php             throw UnableToReadFile::fromLocation($path);

        }



        rewind($readStream);



        return $readStream;

    }