Mine
public php v1 · immutablefunction value($matches) { global ${$matches[1]}; if (is_array(${$matches[1]})) return ${$matches[1]}[$matches[2]]; else return ${$matches[1]};}$tpl_main = preg_replace_callback("/<\!--[$](.*)\[(.*)\]-->/" , 'value' , $tpl_main);$tpl_main = preg_replace_callback("/<\!--[$](.*)-->/" , 'value' , $tpl_main);