With foreach () loop three-dimensional array

<?php

  $data = array(

    = 0> Array (
         'Chinese' => 'china',
        'US' => 'usa',
        'Germany' => 'Germany', 
    ) ,
    
    =. 1> Array (
         'Hubei' => 'hubei',
        'Hebei' => 'hebei',
        'Shandong' => 'shandong',
        'Shanxi' => 'Sanxi', 
    ) ,

);

the foreach ( $ Data  AS  $ val ) {   // first two cycles to which the internal array variable $ val

    the foreach ( $ val  AS  $ Key => $ value ) { // cycle again, the $ val to pay $ value and the key values are separated. 
        echo  $ Key .'-------- '. $ value .' <br> '; // output 
    }
    
}

 

 

 

Guess you like

Origin www.cnblogs.com/xm666/p/11082950.html