title: Recreate original PHP array from print_r output
body: <p>Let's say I have this output from some source where I don't have access to the original PHP created array:</p>
  <pre><code>Array
  (
      [products] =&gt; Array
          (
              [name] =&gt; Arduino Nano Version 3.0 mit ATMEGA328P
              [id] =&gt; 10005
          )
  
      [listings] =&gt; Array
          (
              [category] =&gt; 
              [title] =&gt; This is the first line
  This is the second line
              [subtitle] =&gt; This is the first subtitle
  This is the second subtitle
              [price] =&gt; 24.95
              [quantity] =&gt; 
              [stock] =&gt; 
              [shipping_method] =&gt; Slow and cheap
              [condition] =&gt; New
              [defects] =&gt; 
          )
  
      [table_count] =&gt; 2
      [tables] =&gt; Array
          (
              [0] =&gt; products
              [1] =&gt; listings
          )
  
  )
  </code></pre>
  <p>Now I would like to input that data and have an algorithm recreate the original array that it was printing so I can then use it for my own application.</p>
  <p>Currently I am thinking about a <code>sub_str()</code> and regex statements that pull data and place it appropriately. Before I head further, is there a simpler way, via already written code or php plugins that do this for me already out there?</p>
  <p>IT MUST WORK FOR MULTIDEMNSIONAL ARRAY - so this post does not work and it even references the correct function to use:
  <a href="https://stackoverflow.com/questions/7025909/how-create-an-array-from-the-output-of-an-array-printed-with-print-r">How create an array from the output of an array printed with print_r?</a></p>