谁可以缩短此代码?
private function replaceFunc($subject)
{
foreach($this->func as $t)
{
preg_match_all('/\{'.$t.'\([a-zA-Z,\']+\)\}/i', $subject, $res);
for($j = 0; $j < sizeof($res[0]); $j++)
{
preg_match('/\([a-zA-Z,\']+\)/i', $res[0][$j], $match);
if($match > 0)
{
$prep = explode(", ", substr($match[0], 1, -1));
$args = array();
for($i = 0; $i < sizeof($prep); $i++)
{
$args[] = substr($prep[$i], 1, -1);
}
}
else
{
$args = array();
}
$subject = preg_replace('/\{'.$t.preg_quote($match[0]).'\}/i', call_user_func_array($t, $args), $subject);
}
}
return $subject;
}