note 115116 deleted from function.array-merge by salathe

From: Date: Mon, 06 Sep 2021 22:47:01 +0000
Subject: note 115116 deleted from function.array-merge by salathe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-216910@lists.php.net to get a copy of this message
Note Submitter: rajaimranqamer at gmail dot com ---- to get unique value from multi dimensional array use this instead of array_unique(), because array_unique() does not work on multidimensional: array_map("unserialize", array_unique(array_map("serialize", $array))); Hope this will help someone; Example $a=array(array('1'),array('2'),array('3'),array('4)); $b=array(array('2'),array('4'),array('6'),array('8)); $c=array_merge($a,$b); then write this line to get unique values $c=array_map("unserialize", array_unique(array_map("serialize", $c))); print_r($c);

« previous php.notes (#216910) next »