2010-12-16 49 views
2

我一直在玩這個了一整天,還沒有想出一個好辦法做到這一點匹配的元素...PHP - 數組中

我有兩個數組,我試圖創建一個基於陣列在匹配值。

//$original 

    Array 
    (
     [0] => Array 
      (
       [items] => Array 
        (
         [0] => Array 
          (
           [0] => PA 
           [1] => DZ 
           [2] => ER 
           [3] => TY 
          ) 

         [1] => Array 
          (
           [0] => KV 
           [1] => EN 
           [2] => CR 
          ) 

         [2] => Array 
          (
           [0] => HU 
           [1] => GO 
           [2] => GA 
           [3] => FI 
          ) 
        ) 
      ) 
    ) 


//$compare  
    Array 
    (
     [0] => Array 
      (
       [items] => Array 
        (
         [0] => Array 
          (
           [0] => PA 
           [1] => AN 
           [2] => ER 
          ) 

         [1] => Array 
          (
           [0] => KV 
          ) 

         [2] => Array 
          (
           [0] => HU 
           [1] => XV 
           [2] => ZL 
           [3] => FI 
          ) 
        ) 
      ) 
    ) 

而且我想產生

//$similar 
    Array 
    (
     [0] => Array 
      (
       [items] => Array 
        (
         [0] => Array 
          (
           [0] => PA 
           [2] => ER 
          ) 

         [1] => Array 
          (
           [0] => KV 
          ) 

         [2] => Array 
          (
           [0] => HU 
           [3] => FI 
          ) 
        ) 
      ) 
    ) 

回答