I have html template files that I load in the files are things like $var what I need to do is replace the $var with the value that is stored in $var. I don't know what variable names are in the template file until I load it. I just need to replace the variable names with their values before I output them.
I think something like this is getting close to being right:
$contents = preg_replace("s/(\$[\w[]{}']+)/",".global $1.",$contents);
The vars are global since this is in a function.
Please help me trying to figure this out for 4 hours been on IRC and different mailing lists nobody seems to know how.