Question

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

Was it helpful?

Solution

This should work:

foreach($var['docs'] as $sub) {
    echo $sub['imgurl'];
}

OTHER TIPS

foreach ($arr['docs'] AS $key => $link) {
  echo $link['imgurl'].'<br />';
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top