note 57202 deleted from function.array-unique by danbrown

From: Date: Sun, 23 Jan 2011 17:24:38 +0000
Subject: note 57202 deleted from function.array-unique by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-176198@lists.php.net to get a copy of this message
Note Submitter: kenrbnsn at rbnsn dot com ---- Yet another Array_Unique for multi-demensioned arrays. I've only tested this on two-demensioned arrays, but it could probably be generalized for more, or made to use recursion. This function uses the serialize, array_unique, and unserialize functions to do the work. <?php function multi_unique($array) { foreach ($array as $k=>$na) $new[$k] = serialize($na); $uniq = array_unique($new); foreach($uniq as $k=>$ser) $new1[$k] = unserialize($ser); return ($new1); } ?>

« previous php.notes (#176198) next »