Looping through specific array elements
<p>I have a table and each row contains, among other things, 5 columns which may or may not contain an image file name. Let's say I've retrieved that row and put it into an assoc array. I want to loop through and echo those image file names (cols may or may not all be populated) into html tags, but only if that column has an image file name in it. Is there a better way to do it than this? </p>

<pre><code>for ($i = 1; $i &lt; 6; $i++){
if($item_array['image_' . {$i}]{
echo "&lt;li&gt;&lt;img src=\"images/work-items/$item_array['image_' . {$i} . '.jpg'\"/&gt;&lt;/li&gt;"
}  
</code></pre>
