The function of PHP to remove duplicate values of an array can also be understood as removing duplicate values of an array.
/*** the difference between the array and the Array_unique function: it requires Val to be a string, and this can be an array/object * * @param $arr the array to be drained * @param $reserveKey preserve the original key* @return array */function M_arrayunique ($arr, $reserveKey =false) {if (Is_array ($arr) &&!empty ($arr)) {foreach ($arr as $key = > $value) {$tmpArr [$key]=serialize ($value). ';} $TMPARR =array_unique ($TMPARR), $arr =array (), foreach ($tmpArr as $key + = $value) {if ($reserveKey) {$arr [$key]= Unserialize ($value);} else{$arr []=unserialize ($value);}}} return $arr;}
For how to remove the duplicate values of the two-dimensional array, you can refer to: PHP two-dimensional array to remove duplicate values of the method summary
The above is the function of removing the duplicate value of the array _php the contents of the tutorial, please follow topic.alibabacloud.com (www.php.cn) for more information!
http://www.bkjia.com/PHPjc/764186.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/764186. htmltecharticlephp functions that remove duplicate values from an array can also be understood as removing duplicate values of an array. /*** the difference between an array and a array_unique function: It requires Val to be a string, and this can be ...