public function write($string, $length = null)
    {
        $this->assertWritable();
        if (null === $length) {
            $ret = fwrite($this->stream, $string);
        } else {
            $ret = fwrite($this->stream, $string, $length);
        }
        if (false === $ret) {
            throw new RuntimeException('Cannot write on stream');
        }

        return $ret;
    }
public function write($string, $length = null)
    {
        $this->assertWritable();
        if (null === $length) {
            $ret = fwrite($this->stream, $string);
        } else {
            $ret = fwrite($this->stream, $string, $length);
        }
        if (false === $ret) {
            throw new RuntimeException('Cannot write on stream');
        }

        return $ret;
    }
public function write ( $ string , $ length = null ) { $ this -> assertWritable ( ) ; if ( null === $ length ) { $ ret = fwrite ( $ this -> stream , $ string ) ; } else { $ ret = fwrite ( $ this -> stream , $ string , $ length ) ; } if ( false === $ ret ) { throw new RuntimeException ( 'Cannot write on stream' ) ; } return $ ret ; }
Write data to the stream.
Binary-safe.

@param string $string The string that is to be written.
@param int $length If the length argument is given, writing will stop after length bytes have been written or the end of string is reached, whichever comes first.

@return int Number of bytes written
Write data to the stream . Binary - safe .