Hi,
I'm writing an application in PHP, and I need to replace any word between <!-- *
and * -->
with it's correspondenting element in $vars
.
For example,
<!-- *foobar* -->
In this case 'foobar' must be replaced by the variable $vars["foobar"]
's value. This is what I have now, but it does not work (it always returns <>
:( ):
preg_replace_callback("<!--(\s+)\*([a-zA-Z0-9]+)\*(\s+)-->", create_function('$matches', 'return $vars[$matches];'), $template);
Can anyone help me? Thanks in advance.