Answer the question
In order to leave comments, you need to log in
How to create and display such a PHP array?
Seems like a simple task, but I'm stuck. So first I create an associative array:
foreach ($photo_arr as $photo) {
$arr = array(
'mini' => 'thumbs/'.$photo, // адрес к миниатюрке фото
'big' => 'full/'.$photo //адрес к полноразмерному изображению
);
}
<? foreach ($arr as $k => $val) { ?>
<a href="<?=$val['big']?>">
<img src="<?=$val['mini']?>">
</a>
<? } ?>
Answer the question
In order to leave comments, you need to log in
<a href="<?=$arr['big']?>">
<img src="<?=$arr['mini']?>">
</a>
<?
$arr = array();
foreach ($photo_arr as $photo) {
$arr[] = array(
'mini' => 'thumbs/'.$photo, // адрес к миниатюрке фото
'big' => 'full/'.$photo //адрес к полноразмерному изображению
);
}
?>
<? foreach ($arr as $item) { ?>
<a href="<?=$item['big']?>">
<img src="<?=$item['mini']?>">
</a>
<? } ?>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question