sString = $sString; $this->iLen = strlen($sString); } /** * Set up any resources needed to perform work. */ function open($mode = "r") { } /** * Take care of getting rid of any active resources. */ function close() { } /** * Behaves like fread */ function read($iBytes) { if (($this->iPos + $iBytes) > $this->iLen) { $iBytes = $this->iLen - $this->iPos; } $sRet = substr($this->sString, $this->iPos, $iBytes); $this->iPos += $iBytes; return $sRet; } /** * Behaves like fwrite */ function write($sData) { $this->sString .= $sData; return true; } function get_contents() { return $this->sString; } function put_contents($sData) { $this->sString = $sData; return true; } function eof() { if ($this->iPos >= $this->iLen) { return true; } return false; } function filesize() { return strlen($this->sString); } } ?>