如何在php中交叉两个多维数组

时间:2014-10-16 17:07:39

标签: php

这是我的代码,我希望我的结果中一个值匹配$ big_array和$ small array.i已经尝试array_intersect它对我不起作用我希望匹配大数组的值结果在这个案例中$ big_array中的键4

$big_array=array (     
    0 => array (
         0 => array( 
            'p_school' => array ( 
                0 => 'A & T Nursery & Primary School'
            ),
            'p_class' => array (                            
                0 => 1907
            ),                    
            'p_state' => array ( 
                0 => 5  
            ) 
        ) 
     ) ,  
    1 => array  ( 
        0 => array ( 
            'p_school' => array ( 
                0 => 'Radiance Nursery & Primary School, Apata'
            ), 
            'p_class' => array  ( 
                0 => 1909  
            ),  
            'p_state' => array  ( 
                0 => 8  
            )  
        )  
    ),     
    2 => array  (   
        0 => array  (  
            'p_school' => array  (  
                0 => 'A & T Nursery & Primary School '
            ), 
            'p_class' => array  (  
                0 => 1916 
            ),  
            'p_state' => array  ( 
                0 => 12  
                )   
            ) 
         ),     
    3 => array ( 
        0 => array  (  
            'p_school' => array (  
                0 => 'A & T Nursery & Primary School' 
            ),  
            'p_class' => array  ( 
                0 => 1915  
            ),  
            'p_state' => array  (  
                0 => 6   
                )   
            ) 
        ),     
    4 => array (  
        0 => array  (  
            'p_school' => array ( 
                0 => 'Radiance Nursery & Primary School, Apata'
            ), 
            'p_class' => array  ( 
                0 => 1909  
            ), 
            'p_state' => array  (  
                0 => 8  
                ) 
            )  
        ) 
    ); 


$small_array= array(
    0=>array (  
        0 => array  (  
            'p_school' => array ( 
                0 => 'Radiance Nursery & Primary School, Apata'
            ), 
            'p_class' => array  ( 
                0 => 1909  
            ), 
            'p_state' => array  (  
                0 => 8  
                ) 
            )  
        )  
    ) ;

//thanks in advance

0 个答案:

没有答案