note 45892 added to function.array-unique

From: Date: Wed, 22 Sep 2004 16:29:25 +0000
Subject: note 45892 added to function.array-unique
Groups: php.notes 
Request: Send a blank email to php-notes+get-77163@lists.php.net to get a copy of this message
My Array_unique function wich conserv key order : function array_unique($array) { $out = array(); // loop through the inbound $key1 = 0; foreach ($array as $key=>$value) { // if the item isn't in the array if (!in_array($value, $out)) { // add it to the array $out[$key1] = $value; $key1++; } } return $out; } Thanks to Justin ---- Manual Page -- http://www.php.net/manual/en/function.array-unique.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+45892 Delete -- http://master.php.net/manage/user-notes.php?action=delete+45892&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+45892&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#77163) next »