$aaa = preg_replace('/<%var.\$(fullname).%>/is', $_SESSION["\1"], $aaa);
+1
A:
You can use preg_replace_callback instead:
$line = preg_replace_callback(
'/<%var.\$(fullname).%>/is',
create_function(
'$matches',
'return $_SESSION[$matches[1]];'
),
$line
);
Though I would be wary of where you're getting the input string from: I would be wary if it's coming from users (it looks like it might be coming from some kind of configuration or template file, though, which is probably OK).
Dean Harding
2010-07-02 05:21:33
work fine thank a lot
monkey_boys
2010-07-03 04:43:22