PHP dump variable as PHP code
<p>I'm looking for a function to dump a multi-dimension array so that the output is valid php code.</p>

<p>Suppose I have the following array:</p>

<pre><code>$person = array();
$person['first'] = 'Joe';
$person['last'] = 'Smith';
$person['siblings'] = array('Jane' =&gt; 'sister', 'Dan' =&gt; 'brother', 'Paul' =&gt; 'brother');
</code></pre>

<p>Now I want to dump the $person variable so the the dump string output, if parsed, will be valid php code that redefines the $person variable.</p>

<p>So doing something like:</p>

<pre><code>dump_as_php($person);
</code></pre>

<p>Will output:</p>

<pre><code>$person = array(
    'first'    =&gt; 'Joe',
    'last'     =&gt; 'Smith',
    'siblings' =&gt; array(
        'Jane' =&gt; 'sister',
        'Dan'  =&gt; 'brother',
        'Paul' =&gt; 'brother'
    )
);
</code></pre>
