note 57202 added to function.array-unique

From: Date: Tue, 27 Sep 2005 04:09:14 +0000
Subject: note 57202 added to function.array-unique
Groups: php.notes 
Request: Send a blank email to php-notes+get-95849@lists.php.net to get a copy of this message
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); } ?> ---- Manual Page -- http://www.php.net/manual/en/function.array-unique.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+57202 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+57202&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+57202&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+57202&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+57202&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+57202&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+57202&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+57202&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+57202&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#95849) next »