I was wondering if you can construct a PHP variable from another variable.
I want to build a dynamic variable based on the output of another variable.
$cf = new RecursiveDirectoryIterator(dirname(__DIR__) . DS . "configuration");
foreach (new RecursiveIteratorIterator($cf) as $filename => $file) {
if ($cf->getFilename() != "." && $cf->getFilename() != "..") {
$ex = explode(".", $filename);
$_.$ex[0] = parse_ini_file($filename, true);
}
}
in that code above I want to look through my configuration folder and making ouputing something like this.
Lets say we have db.ini, and theme.ini in the configuration folder
so the output would hopefully look like
$_db = parse_ini_file("db.ini", true);
$_theme = parse_ini_file("theme.ini", true);
I thought maybe concatenating variables together I could make a new variable ;-)
The scenario is that I want to dump as many .ini files into my configuration folder and have my script dynamically make the $_ variables for me with the parse_ini_file function loaded for that file.
or am I just nuts?