Remove duplicate data from the array to remove duplicates from the array
Difference from the array_unique function: it requires that val be a string, and this can be an array/object.
/*** Difference between array weighting * and the array_unique function: it requires that val be a string, this can be an array/object ** @ param unknown_type $ array to which arr will record the weight * @ param unknown_type $ reserveKey whether to retain the original Key * @ return unknown */static 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 ;}