rendered paste body<?phpclass Template { private $vars = array(); private $templateVars = array('names' => array(), 'values' => array()); public function __get($key){ return $this->vars[$key]; } public function __set($key, $value){ $this->vars[$key] = $value; $this->templateVars['names'][] = '#'.$key.'#'; $this->templateVars['values'][] = $value; } public function parse($html){ return str_replace($this->templateVars['names'], $this->templateVars['values'], $html); }}$tpl = new Template();$tpl->something = 'a replaced varaible';$html = 'Some string with #something# in it';echo $tpl->parse($html);echo "<br />\$tpl->something is {$tpl->something}";?>