note 51941 modified in function.array-unique by danbrown

From: Date: Thu, 06 Nov 2008 15:07:54 +0000
Subject: note 51941 modified in function.array-unique by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-146230@lists.php.net to get a copy of this message
<?php /** * 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; } ?> --was-- /** * 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; } http://php.net/manual/en/function.array-unique.php

« previous php.notes (#146230) next »