public function write($string)
    {
        $encodedLine = quoted_printable_encode($this->lastLine);
        $lineAndString = rtrim(quoted_printable_encode($this->lastLine . $string), "\r\n");
        $write = substr($lineAndString, strlen($encodedLine));
        $this->stream->write($write);
        $written = strlen($string);
        $this->position += $written;

        $lpos = strrpos($lineAndString, "\n");
        $lastLine = $lineAndString;
        if ($lpos !== false) {
            $lastLine = substr($lineAndString, $lpos + 1);
        }
        $this->lastLine = quoted_printable_decode($lastLine);
        return $written;
    }
public function write($string)
    {
        $encodedLine = quoted_printable_encode($this->lastLine);
        $lineAndString = rtrim(quoted_printable_encode($this->lastLine . $string), "\r\n");
        $write = substr($lineAndString, strlen($encodedLine));
        $this->stream->write($write);
        $written = strlen($string);
        $this->position += $written;

        $lpos = strrpos($lineAndString, "\n");
        $lastLine = $lineAndString;
        if ($lpos !== false) {
            $lastLine = substr($lineAndString, $lpos + 1);
        }
        $this->lastLine = quoted_printable_decode($lastLine);
        return $written;
    }
public function write ( $ string ) { $ encodedLine = quoted_printable_encode ( $ this -> lastLine ) ; $ lineAndString = rtrim ( quoted_printable_encode ( $ this -> lastLine . $ string ) , "\r\n" ) ; $ write = substr ( $ lineAndString , strlen ( $ encodedLine ) ) ; $ this -> stream -> write ( $ write ) ; $ written = strlen ( $ string ) ; $ this -> position += $ written ; $ lpos = strrpos ( $ lineAndString , "\n" ) ; $ lastLine = $ lineAndString ; if ( $ lpos !== false ) { $ lastLine = substr ( $ lineAndString , $ lpos + 1 ) ; } $ this -> lastLine = quoted_printable_decode ( $ lastLine ) ; return $ written ; }
Writes the passed string to the underlying stream after encoding it as
quoted-printable.

Note that reading and writing to the same stream without rewinding is not
supported.

@param string $string
@return int the number of bytes written
Writes the passed string to the underlying stream after encoding it as quoted - printable .