PHP is it possible to convert array to vars and pass them somewhere
<p>In short, what I want is a kind of export() function (but not export()), it creates new variables in symbol table and returns the number of created vars.</p>

<p>I'm trying to figure out if it is possible to declare a function</p>

<pre><code>function foo($bar, $baz)
{
    var_dump(func_get_args());
}
</code></pre>

<p>And after that pass an <strong>array</strong> so that each value of array would represent param.</p>

<p>Just wondering if it is possible (seems that is not).</p>

<p>I need this for dynamic loading, so number of arguments, size of array may vary - please dont offer to pass it as </p>

<pre><code>foo($arr['bar']);
</code></pre>

<p>and so on.</p>

<p>Again, ideal thing solution will look like</p>

<pre><code>foo(array('foo'=&gt;'1', 'bar'=&gt;'2', ..., 'zzz'=&gt;64));
</code></pre>

<p>for declaration</p>

<pre><code>function foo($foo, $bar, ..., $zzz) {}
</code></pre>

<p>As far as I rememeber in some dynamical languages lists may behave like that (or maybe I'm wrong).</p>

<p>(I want to create dynamically parametrized methods in class and built-in mechanism of controlling functions arguments number, default value and so on is quite good for this, so I could get rid of array params and func_get_args and func_get_num calls in the method body). </p>

<p>Thanks in advance.</p>
