Why does PHP not find the variable I'm referring to in this small code?
<p>Why do I get 'undefined variable $image_src' with this code:</p>

<pre><code>$image_src1=null;
$image_src2=null;
for ($i=1; $i&lt;=$nr_of_pics; $i++) {
     $image_src.$i = $image_id.'_'.$i;
     }

    echo $image_src1;
</code></pre>

<p>I want the <code>$image_src.$i</code> to refer to the variable <code>$image_src1</code> or <code>$image_src2</code> depending on how many loops there are... But it wants to find the variable <code>$image_src</code> without an ending nr, which doesn't exist, because I want it to find the variable with the '$i' ending!</p>

<p>It doesn't get that the <code>$i</code> is for the last number in the variable <code>$image_src</code> name!</p>

<p>Rest of the code is fine!</p>

<p>Thanks</p>
