note 46871 deleted from function.array-unique by sobak

From: Date: Sun, 11 Dec 2016 06:52:52 +0000
Subject: note 46871 deleted from function.array-unique by sobak
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-208480@lists.php.net to get a copy of this message
Note Submitter: lucas.bickel AT purplehaze DOT ch ---- I quite like the following code for making multidimensional arrays unique: <?php foreach ($arrAddressList AS $key => $arrAddress) { $arrAddressList[$key] = serialize($arrAddress); } $arrAddressList = array_unique($arrAdressList); foreach ($arrAddressList AS $key => $strAddress) { $arrAddressList[$key] = unserialize($strAddress); } ?> This gets me a unique array while not minding wether the the original array contains arrays or just strings (or whatever...).

« previous php.notes (#208480) next »