I have 2 dynamic arrays with variable number of strings that is a conditional
selection from a mysql database using php php
$imagearray()
$thumbarray()
Both arrays will have the same number of strings.
Example $imagearray[0] = “images/large/5.jpg”
$imagearray[1] = “images/large/3.jpg”
$imagearray[2] = “images/large/8.jpg”
…and so on
$thumbarray[0] = "images/thumbs/5.jpg
$thumbarray[1] = “images/thumbs/3.jpg”
$thumbarray[2] = “images/thumbs/8.jpg”
…and so on
The html-php code looks like this:
<?php foreach ($proarray as $large):?><span id="<?=$large['pro_id'];?>"> <img src="<?=$large['proimage']?>" /></span>
<?php endforeach;?>
This works and I get the following html code
<div id="large"you will notice the first thumbs <a href line has a class, the rest don’t
I want to use a php foreach statement
and want to check if its the first image in the array
here is my code that doesn’t work
<div id="thumbs">
<?php $i=0;?>
<?phpforeach ($thumbarray as $thumb):?>
` <?phpif ($i == 0)?>
<?php if ($i!= 0) ?>
<?php$i++;?>
<?php endforeach;?>