add value to array in for loop will not work, why?
<p>Take a look:</p>

<pre><code>for ($i=1; $i&lt;=$nr_of_pics; $i++) {
     ${'image_src' . $i} = $image_id.'_'.$i;
     $img_array = imageSize(${'image_src' . $i}, $i, $category);


    }
</code></pre>

<p>and here is the imageSize function (simplified):</p>

<pre><code>$myarr = array();
    $myarr['thumb_image_' . $nr . '_width'] = $thumb_width;
    $myarr['thumb_image_' . $nr . '_height'] = $thumb_height;
    $myarr['image_' . $nr . '_width'] = $width;
    $myarr['image_' . $nr . '_height'] = $height;
    return $myarr;
</code></pre>

<p>The function gets called and OWERWRITES the value of the $img_array inside the foor-loop, but I need it to 'increment' and add values after another in every loop.
So basically, it replaces its value every time it loops.
What should I do here?</p>

<p>Thanks</p>
