Code:
/** * Removes duplicate keys from an array * * @param array $array * @return array */ function array_unique_key($array) { $result = array(); foreach (array_unique(array_keys($array)) as $tvalue) { $result[$tvalue] = $array[$tvalue]; } return $result; }
Leave a Reply