Skip to content

Stream: __toString Example

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

Shieldon\Psr7\Stream

__toString()

Reads all data from the stream into a string, from the beginning to end.

  • return string

Example:

$stream = new Stream(fopen('php://temp', 'r+'));
$stream->write('Foo Bar');

echo $stream;
// Outputs: Foo Bar