Forum Moderators: coopster
I've tried foreach ($images as $image, $widths as $width, $lefts as $left) (and retrospectivly changed $width = array... to $widths = array... etc.)
But it says it has too many parimiters, or something like that.
Should I be doing this another way? Like using 'while' (which I don't know how to use).
<?php
$images = array('00', '01', '02', '03', '04', '05', '06', '07', '08', '09');
$width = array('25', '25', '26', '26', '26', '27', '25', '27', '26', '25');
$left = array('31', '56', '81', '107', '133', '159', '186', '211', '238', '264');
foreach ($images as $image) {
echo '<a href=""><img src="pix/m_'.$image.'.gif" width="'.$width.'" height="16" id="'.$image.'" style="border: 0px; position:absolute; left:'.$left.'px; top:6px;" /></a>'."\n\n";
}
?>
Thanks,
Justin.
$num_elements=count($image);
for ($i=0; $i < $num_elements; $i++) {
echo("<img src=\"$image[$i]\" width=\"$width[$i]\" height=\"16\">");
}
That basically increments the variable $i which you then use as an index to the array eg $image[$i]