dynamically put together a variable from other variables in php
<p>I was wondering if you can construct a PHP variable from another variable.</p>

<p>I want to build a dynamic variable based on the output of another variable.</p>

<pre><code>$cf = new RecursiveDirectoryIterator(dirname(__DIR__) . DS . "configuration");

foreach (new RecursiveIteratorIterator($cf) as $filename =&gt; $file) {
    if ($cf-&gt;getFilename() != "." &amp;&amp; $cf-&gt;getFilename() != "..") {
        $ex = explode(".", $filename);
        $_.$ex[0] = parse_ini_file($filename, true);
    }
}
</code></pre>

<p>in that code above I want to look through my configuration folder and making ouputing something like this.</p>

<p>Lets say we have db.ini, and theme.ini in the configuration folder</p>

<p>so the output would hopefully look like</p>

<pre><code>$_db = parse_ini_file("db.ini", true);
$_theme = parse_ini_file("theme.ini", true);
</code></pre>

<p>I thought maybe concatenating variables together I could make a new variable ;-)</p>

<p>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.</p>

<p>or am I just nuts?</p>
