linux1880 Posted August 6, 2010 Share Posted August 6, 2010 how would i display image without using foreach in this case ? <?php foreach($images as $image): ?> <div class="thumb"> <img src="<?php echo $image['url']; ?>">" /> <img src="<?php echo $image['thumb_url']; ?>" /> <?php endforeach; ?> Quote Link to comment https://forums.phpfreaks.com/topic/210012-how-to-call-object-without-foreach/ Share on other sites More sharing options...
wildteen88 Posted August 6, 2010 Share Posted August 6, 2010 Well the variable $images appearers to be a multi-dimensional array. How is this array formatted? To display an image from the array, aslong as you know how it is formatted you can do <img src="<?php echo $images['some_key_here']['url']; ?>">" /> <img src="<?php echo $image['some_key_here']['thumb_url']; ?>" /> Quote Link to comment https://forums.phpfreaks.com/topic/210012-how-to-call-object-without-foreach/#findComment-1096110 Share on other sites More sharing options...
linux1880 Posted August 6, 2010 Author Share Posted August 6, 2010 the $images array was declared like this $images[]= array(); what does it mean ? Quote Link to comment https://forums.phpfreaks.com/topic/210012-how-to-call-object-without-foreach/#findComment-1096115 Share on other sites More sharing options...
wildteen88 Posted August 6, 2010 Share Posted August 6, 2010 It is adding an empty array item to the $items array. Quote Link to comment https://forums.phpfreaks.com/topic/210012-how-to-call-object-without-foreach/#findComment-1096117 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.