arrays - Output of multiarray values with php -


i'm trying output values multiarray php, can't head around on how retrieve specific value each entry.

array -

array (     [images] => array         (             [0] => array                 (                     [image] => sample1.jpg                 )                  [1] => array                     (                         [image] => sample2.jpg                     )              )      ) 

code -

if ($query) {     foreach ( $query $outer_array ) {         foreach ( $outer_array $inner_array ) {             $html .= '<img src="' . $inner_array[image] . '" alt="" />';         }     } } 

current output -

<img src="" alt="" /> <img src="" alt="" /> 

this gives me blank weird results. tried dozen different approaches, guess i'm not enough proficient in how multiarrays work.

edit: went approach. help!

if structure in example can save 1 of loops directly looping on $query['images']:

if (!empty($query['images'])) {     foreach((array) $query['images'] $image) {         $html .= '<img src="' . $image['image'] . '" alt="" />';     } } 

Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -