Skip to content

Stream: __toString Example

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

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
Clone this wiki locally