二维数组去掉重复值

 //二维数组去掉重复值
  /*
   *  $array 二维数组
   *  $stkey 一级数组键是否保留(可为非数字) true:保留  false:不保留
*  $ndkey 一级数组键是否保留(二级数组键必须相同) true:保留  false:不保留
   */
  public function a_array_unique($array){
      $out = array();

      foreach ($array as $key=>$value) {
          if (!in_array($value, $out)){
              $out[$key] = $value;
          }
      }

      $out = array_values($out);
      return $out;
  }

猜你喜欢

转载自blog.csdn.net/qq_42449958/article/details/84429660