How to increase 1 for each image with php
<p>I have the following array output.</p>

<pre><code>Array
(
    [0] =&gt; Training centers
    [22] =&gt; Training center ABC
    [16] =&gt; Training center CCF
    [17] =&gt; Training center LLI
    [23] =&gt; Training center BBC

 ...
)
</code></pre>

<p>Using this I want to echo out like this.</p>

<pre><code>&lt;ul&gt;
&lt;li&gt;&lt;a href="center/22"&gt;&lt;img src="center1.jpg" alt="Training center ABC" /&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="center/16"&gt;&lt;img src="center2.jpg" alt="Training center CCF" /&gt;&lt;/a&gt;&lt;/li&gt;
...
</code></pre>

<p>And so on. I am using foreach($centers as $key=>$center), but not sure how to increase the image number. I already have these images ready. But the number of center won't be known.</p>

<p>I tried the following but it does not show what I want.</p>

<pre><code>echo "&lt;ul&gt;\n";
foreach($centres as $key=&gt;$centre){
    echo '&lt;li&gt;&lt;a href="mycentre/admin/manage_mycentre/'.$key.'"&gt;';
    for ($i = 1; $i &lt;= 10; $i++) {

        echo "&lt;img src=\"assets/images/centre/centre$i.jpg\" /&gt;";
    }
    echo "&lt;/a&gt;&lt;/li&gt;\n";
}
echo "&lt;/ul&gt;\n";
</code></pre>

<p>Thanks in advance.</p>
