array_merge & array_unique

后端 未结 5 735
-上瘾入骨i
-上瘾入骨i 2020-12-11 02:46

Is there an array function in PHP that somehow does array_merge, comparing the values, ignoring the keys? I think that array_unique(array_merge($a, $b

5条回答
  •  悲哀的现实
    2020-12-11 03:02

    function umerge($arrays){
     $result = array();
     foreach($arrays as $array){
      $array = (array) $array;
      foreach($array as $value){
       if(array_search($value,$result)===false)$result[]=$value;
      }
     }
     return $result;
    }
    

提交回复
热议问题