php - Help accessing this multidimensional array -


i have array

    array (     [disc-art] => array         (             [original] => upload/c/4/c4eea45ce0f5e8d5698f5ff2d18b4566.jpg             [preview] => array                 (                     [dvd-disc] => upload/c/4/d_disc_c4eea45ce0f5e8d5698f5ff2d18b4566.jpg                 )          )      [cover-art] => array         (             [original] => upload/7/2/72bb5a03708c99c822a792c76c00e8d1.jpg             [preview] => array                 (                     [dvd-cover] => upload/7/2/d_cover_72bb5a03708c99c822a792c76c00e8d1.jpg                     [dvd-spine] => upload/7/2/d_spine_72bb5a03708c99c822a792c76c00e8d1.jpg                     [dvd-back] => upload/7/2/d_back_72bb5a03708c99c822a792c76c00e8d1.jpg                 )          )      [insert-art] => array         (             [original] => upload/b/1/b1f8e49d77121c01011acaa90cabc8ee.jpg             [preview] => array                 (                     [dvd-insert] => upload/b/1/d_insert_b1f8e49d77121c01011acaa90cabc8ee.jpg                 )          )      [boxshot] => array         (             [preview] => array                 (                     [boxshot] => upload/7/2/d_boxshot_72bb5a03708c99c822a792c76c00e8d1.jpg                 )          )  ) 

i want return array accesses each preview , gets contents

array('dvd-disc' => '...path...', 'dvd-cover' => '...path...', etc...) 

please help, has been long day , want go home! :)

edit:

correction - want final array this...

array(     'dvd-disc' => '<img src="'.$path.'" alt="'.$type.'" />',     'dvd-cover' => '<img src="'.$path.'" alt="'.$type.'" />',      etc... ); 

where $path value of each preview's sub-value , $type value of each preview's sub-key

$new_array = array(); foreach($main_array $sub_array) {    if(isset($sub_array['preview']))    {        foreach($sub_array['preview'] $type => $image_url)        {            $new_array[$type] = '<img src="'.$image_url.'" alt="'.$type.'" />';        }    } } 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -