Skip to content

Stream: write Example

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

Shieldon\Psr7\Stream

write($string)

  • param string string * The string that is to be written.
  • return int Returns the number of bytes written to the stream.

Example:

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

echo $stream->getContents();

// Outputs: Foo Bar
Clone this wiki locally