PHP Function Reference

PHP streamWrapper stream_read() Method



The PHP streamWrapper::stream_read() method reads from stream. This method is called in response to to fread() and fgets().

Note: Remember to update the read/write position of the stream (by the number of bytes that were successfully read).

Syntax

public streamWrapper::stream_read(count)

Parameters

count Required. Specify how many bytes of data from the current position should be returned.

Return Value

Returns the number of bytes that were successfully stored, or 0 if none could be stored. If there are less than count bytes available, return as many as are available. If no more data is available, return either false or an empty string.

Exceptions

Emits E_WARNING if call to this method fails (i.e. not implemented). If the return value is longer than count, an E_WARNING error will be emitted, and excess data will be lost.


❮ PHP Streams Reference