Create variable from print_r output
<p>How can i create variable from it's print_r output ? In other words, i'd like to know if something similar to my fictive <code>var_import</code> function exists in php ? <code>var_import</code> would be the inverse of <code>var_export</code></p>

<p>He is a use case:</p>

<p>

<pre><code>$a = var_import('Array ( [0] =&gt; foo [1] =&gt; bar )');
$output = var_export($a);
echo $output; // Array ( [0] =&gt; foo [1] =&gt; bar )
</code></pre>

<p>If such a function does not exist, is there a tool (or online tool) to do this ?
I am also interested to do the same with <code>var_dump</code> output.</p>

<p><strong>EDIT: The variable is only available as a print_r output (string).</strong> To clarify what i need, imagine the folowing situation: someone posts a some sample on the internet somewhere with a print_r output. To test his code, you need to <code>import</code> his print_r variable into your code. This is an example where <code>var_import</code> would be usefull.</p>
