php remove duplicates from array

后端 未结 5 996
余生分开走
余生分开走 2020-12-20 23:30

I was wondering if anyone could help me out, I\'m trying to find a script that will check my entire array and remove any duplicates if required, then spit out the array in t

5条回答
  •  礼貌的吻别
    2020-12-20 23:56

    My PHP's rusty, but something like this should work:

    function makeUniqueBidArray(&$array)
    {
      $tempArray = array();
      foreach($array as $bidArray) {
        foreach($bidArray as $bid) {
          if (isset($tempArray[$bid->bid]) {
            unset($bid);
          } else {
            $tempArray[$bid->bid] = $bid->name;
          }
        }
      }
    }
    

提交回复
热议问题