title: PHP memory exhausted when running through thousands of records
body: <p>I'm running the following code over a set of 5,000 results. It's failing due to the memory being exhausted.</p>
  
  <pre><code>foreach ($data as $key =&gt; $report) {
    $data[$key]['data'] = unserialize($report['serialized_values']);
  }
  </code></pre>
  
  <p>I know I can up the memory limit, but I'd like to run this without a problem instead. I'm not going to be able to keep upping the memory forever.</p>
  
  <hr>
  
  <p><strong>EDIT</strong></p>
  
  <p>The <code>$data</code> is in this format:</p>
  
  <pre><code>[1] =&gt; Array
      (
          [0] =&gt; 127654619178790249
          [report_id] =&gt; 127654619178790249
          [1] =&gt; 1
          [user_id] =&gt; 1
          [2] =&gt; 2010-12-31 19:43:24
          [sent_on] =&gt; 2010-12-31 19:43:24
          [3] =&gt; 
          [fax_trans_id] =&gt; 
          [4] =&gt; 1234567890
          [fax_to_nums] =&gt; 1234567890
          [5] =&gt; ' long html string here',
          [html_content] =&gt; 'long html string here',
          [6] =&gt; 'serialization_string_here',
          [serialized_values] =&gt; 'serialization_string_here',
          [7] =&gt; 70
          [id] =&gt; 70
      )
  </code></pre>