Skip to content

Stream: rewind Example

Terry L edited this page Jun 20, 2020 · 2 revisions
Clone this wiki locally

Shieldon\Psr7\Stream

rewind()

Seek to the beginning of the stream.

  • return void

Example:

$resource = fopen(BOOTSTRAP_DIR . '/sample/shieldon_logo.png', 'r+');
$stream = new Stream($resource);

$stream->seek(10);
echo $stream->tell();
// Outputs: 10

$stream->rewind();
echo $stream->tell();
// Outputs: 0

$stream->close();