Create a variable from each item in a PHP array
<p>I would like to step through a PHP array and create a variable for each entry in it. My array (<strong>$array</strong>) looks like this:</p>

<pre><code>Array
(
    [0] =&gt; Array
        (
            [first_name] =&gt; Arthur
            [last_name] =&gt; Dent
            [planet] =&gt; Earth
        )

    [1] =&gt; Array
        (
            [first_name] =&gt; Ford
            [last_name] =&gt; Prefect
            [planet] =&gt; Betelgeuse
        )

)
</code></pre>

<p>I have got the following:</p>

<pre><code>$0_first_name = $array['0']['first_name'];
$0_last_name = $array['0']['last_name'];
</code></pre>

<p>But this is pretty time consuming, and means I need to explicitly declare each one and then can't allow for extra entries within the array at each level.</p>

<p>What is the best way of doing this?</p>