-3

hi i need to get the values of a var that after making it a var_dump($var) i get:

array(1) {
    ["docs"]=> array(3) { 
        [0]=> array(1) { 
            ["imgurl"]=> string(68) "http://xxxxx.com/demos/grider/wp-content/uploads/2013/02/22.jpg" } 
        [1]=> array(1) { 
            ["imgurl"]=> string(68) "http://xxxxx.com/demos/grider/wp-content/uploads/2013/02/33.jpg" } 
        [2]=> array(1) { 
            ["imgurl"]=> string(68) "http://xxxxx.com/demos/grider/wp-content/uploads/2013/02/22.jpg" } } }

I need to foreach the 2 img url strings starting with http://

Any help would be appreciated.

Thank you

Jose Lo
  • 81
  • 2
  • 10

2 Answers2

2

This should work:

foreach($var['docs'] as $sub) {
    echo $sub['imgurl'];
}
Kermit
  • 33,827
  • 13
  • 85
  • 121
1
foreach ($arr['docs'] AS $key => $link) {
  echo $link['imgurl'].'<br />';
}
djot
  • 2,952
  • 4
  • 19
  • 28