php_stream_write() writes count bytes of data from buf into stream.
php_stream_write() returns the number of bytes that were written successfully. If there was an error, the number of bytes written will be less than count.
The internal position of the stream is advanced by the number of bytes that were written, so that subsequent writes will continue writing from that point.