PHP Function Reference

PHP streamWrapper stream_write() Method



The PHP streamWrapper::stream_write() method writes to stream. This method is called in response to fwrite().

Note: Remember to update the current position of the stream by number of bytes that were successfully written.

Syntax

public streamWrapper::stream_write(data)

Parameters

data Required. Specify the data which need to be stored into the underlying stream. If there is not enough room in the underlying stream, this method stores the data as much as possible.

Return Value

Returns the number of bytes that were successfully stored, or 0 if none could be stored.

Exceptions

Emits E_WARNING if call to this method fails (i.e. not implemented). If the return value is greater the length of data, E_WARNING is emitted and the return value will truncated to its length.


❮ PHP Streams Reference