PHP
流 | Streams

streamWrapper::stream_write

streamWrapper::stream_write

(PHP 4 >= 4.3.2, PHP 5, PHP 7)

streamWrapper::stream_write — Write to stream

Description

public int streamWrapper::stream_write ( string $data )

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.

Parameters

data

Should be stored into the underlying stream.

Note: If there is not enough room in the underlying stream, store as much as possible.

Return Values

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

Errors/Exceptions

Emits E_WARNING if call to this method fails (i.e. not implemented).

Note: If the return value is greater the length of data, E_WARNING will be emitted and the return value will truncated to its length.

See Also

  • fwrite() - Binary-safe file write

← streamWrapper::stream_truncate

streamWrapper::unlink →