note 45656 deleted from function.array-unique by danbrown

From: Date: Sun, 23 Jan 2011 17:25:08 +0000
Subject: note 45656 deleted from function.array-unique by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-176199@lists.php.net to get a copy of this message
Note Submitter: justin at redwiredesign dot com ---- OK, so here's my version that maintains index integrity: <?php function array_unique($array) { $out = array(); // loop through the inbound foreach ($array as $key=>$value) { // if the item isn't in the array if (!in_array($value, $out)) { // add it to the array $out[$key] = $value; } } return $out; } ?>

« previous php.notes (#176199) next »