Today, the problem is that the array removed from the database is a two-dimensional array, now is the two-bit array to go to the weight, but in PHP, for a one-dimensional array, we can directly use the PHP system function Array_unique, but this function does not remove the multidimensional array to duplicate , so I need to write myself a function to remove the duplicate values of the two-dimensional array.
1 functionARRAY_UNIQUE_FB ($array 2D){ 2 3 foreach($array 2D as $v){4 $v=Join(‘,‘,$v);//dimension, you can also convert one-dimensional array to a comma-concatenated string using implode5 6 $temp[]=$v;7 8 }9 Ten $temp=Array_unique($temp);//Remove duplicate strings, that is, duplicate one-dimensional arrays One A foreach($temp as $k=$v){ - - $temp[$k]=Explode(‘,‘,$v);//re-assemble the disassembled array the - } - - return $temp;
Two-dimensional arrays remove duplicate values and Array_unique functions