Turn an array of values into an array of variables
<p><strong>Update</strong></p>

<p>After the initial feedback I got that my question is unclear, I decided to start over and ask it with more context, and clearer details. See <a href="https://stackoverflow.com/questions/38277450/many-php-mysqli-queries-from-one-prepared-statement-without-knowing-how-many-par">Many php mysqli queries from one prepared statement without knowing how many parameters</a></p>

<p>Sorry about the confusion.</p>

<p><strong>Original Question</strong></p>

<p>I'd like to dynamically turn an associative array:</p>

<pre><code>$array =
[
    'key' =&gt; 'AX-2NV',
    'id' =&gt; 2
]
</code></pre>

<p>into an array of variables:</p>

<pre><code>[$key,$id] // where $key='AX-2NV' and $id=2
</code></pre>

<p>When I have no control over the input array.  The variable creation is simple enough with the <code>extract</code> <a href="http://php.net/manual/en/function.extract.php" rel="nofollow noreferrer">function</a></p>

<pre><code>extract($array); // will create the variables $key and $id
</code></pre>

<p>The challenge is how do I get the resulting variables in an array when I don't know ahead of time what the variable names or the input array size will be?</p>

<p>This may be irrelevant but the objective is to make a call to the function <code>call_user_func_array</code> and pass it the array <code>[$key,$id]</code> as the parameters of the function I'm calling. I've considered doing simply</p>

<pre><code>call_user_func_array($function,array_values($array));
</code></pre>

<p>But I still need a handle to these variables for further processing, so just using the values and moving on is not an option.</p>