php - Foreach a specific key from array -


i have array 2 same keys want foreach out if possible. code looks like:

$arrayname = array(     1 => array('detail' => 'detail1' , 'detail' => 'detail2') );  foreach ($arrayname[1] $key['detail'] => $value) {      echo $value; } 

thanks help!

your keys overwriting themselves. may want approach solution this:

$arrayname = array(     array('name' => 'detail' , 'value' => 'detail1'),     array('name' => 'detail' , 'value' => 'detail2') );  foreach ($arrayname $i) {     echo $i['value']; } 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -