I have these codes:
$string = 'Hello [*tt();*], how are you today?';
preg_match("/\[\*(.*?)\*\]/",$string,$match);
$func = $match[1];
$d = eval($func);
$newstring = preg_replace("/\[\*(.*?)\*\]/",$d,$string);
echo $newstring;
function tt() {
return 'test';
}
I think they reach my mean from them. I want to replace tt(); with its output.I expected it works but tt(); replace with nothing(null string).