- substr: documentation ( source)
- stream_wrapper_register: documentation ( source)
- parse_url: documentation ( source)
- gzdeflate: documentation ( source)
- gzinflate: documentation ( source)
<?php
class VariableStream {
var $position;
var $varname;
function stream_open($path, $mode, $options, &$opened_path)
{
$url = parse_url($path);
$this->varname = $url["host"];
$this->position = 0;
return true;
}
function stream_read($count)
{
$ret = substr(gzinflate($GLOBALS[$this->varname]), $this->position, $count);
$this->position += strlen($ret);
return $ret;
}
function stream_eof()
{
return true;
}
function stream_stat()
{
return array(); //return stat(__FILE__);
}
}
stream_wrapper_register("var", "VariableStream");
$myvar = gzdeflate("<?php echo 123;");
include("var://myvar");