01-02-2008, 04:08 PM
|
#1 (permalink)
|
|
The Addict
Join Date: Nov 2007
Posts: 264
Thanks: 2
|
eval - seperate instace.
Does eval() create a seperate parsing instance? to clear up the question are any variables function and classes not available within the eval() function? the reason I ask is because out of curiosity I created this...
PHP Code:
public function __call($funcName,$args)
{
$classArr = array(
'm_' => 'member',
't_' => 'template',
'f_' => 'file',
'u_' => 'upload',
'd_' => 'mysql'
);
$class = substr($funcName,0,2);
$func = str_replace($class,'',$funcName);
$func = preg_replace('$\\((.*?)\\)$','',$func);
$order = $classArr[$class];
if(!empty($order))
{
for($i=0;$i < func_num_args();++$i)
{
$argList .= func_get_arg($i) . ',';
}
$c = substr($argList,strlen($argList) -1,1);
if($c == ',')
{
$argList = substr($argList,0,strlen($argList) -1);
}
$string = sprintf('$this->%s->%s(%s);',$order,$func,'o');
echo $string;
ob_start();
eval($string);
$ret = ob_get_clean();
return $ret;
}
}
|
|
|
|