note 28375 modified in function.array-unique by vrana

From: Date: Tue, 17 Aug 2004 14:50:30 +0000
Subject: note 28375 modified in function.array-unique by vrana
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-79766@lists.php.net to get a copy of this message
in addition to bisqwit: in some cases you can simply use serialize instead of recursivemakehash(). <?php function array_unique2($input) { $tmp = array(); foreach($input as $a => $b) $tmp[$a] = serialize($b); $newinput = array(); foreach(array_unique($tmp) as $a => $b) $newinput[$a] = $input[$a]; return $newinput; } ?> Have fun Juggler --was-- in addition to bisqwit: in some cases you can simply use serialize instead of recursivemakehash(). function array_unique2($input) { $tmp = array(); foreach($input as $a => $b) $tmp[$a] = serialize($b); $newinput = array(); foreach(array_unique($tmp) as $a => $b) $newinput[$a] = $input[$a]; return $newinput; } Have fun Juggler http://php.net/manual/en/function.array-unique.php

« previous php.notes (#79766) next »