Hi all,
I'm developping a site that gets all it's html (includes php scripts) files from an sql database. I'm using the eval() function to good effect but have run into a problem, I can't include files as expected, and/or I can't use global variables as expected.
Example:
globals.php
$var=array('value1','value2'); // a neccessary global variable
index.php
include_once("globals.php");
somefunction($var);
$str="include_once("globals.php"); someotherfunction($var);";
eval($str); // $var is empty
$str="include("globals.php"); someotherfunction($var);";
eval($str); // error about multiple includes
$str="someotherfunction($var);";
eval($str); // $var is empty
So how do I get access to globals from withing eval or how do include files as expected (when $str is seperate file this all works properly)?