I have a multidimensional array ($ array) in which the entries look:
{ ["upload/example.gif"]=> array(5) { ["title"]=> string(12) "This is me" ["excerpt"]=> string(24) "This is a photo of a tree" ["img"]=> string(42) "upload/example.gif" ["link"]=> string(23) "http://www.google.co.uk" ["source"]=> string(6) "custom" } }
I need to remove any duplicate values ββin $array based on key. Therefore, if my array was:
$array = array( ["upload/example.gif"] => etc.... ["upload/tree.gif"] => etc.... ["upload/example.gif"] => etc....)
I could remove one of the arrays ["upload/example.gif"] => etc....
I tried:
$array = array_map('unserialize', array_unique(array_map('serialize', $array)));
but it didnβt work.
Thanks in advance.
source share