-1

I want to remove duplicated values from a two-dimensional array.

I have used array_unique function to the two-dimensional array. And it seems that this function does not work for two-dimensional array.

Any suggestion or help would be appreciated.

Thank you in advance.

Here is my array output below:

Array
(
    [0] => Array
        (
      [Is_Hide] => 0
            [Key] => LHo0VTLsFcI7wWq2EWQy1nUp5U13pXWLXt8s0775
        )

    [1] => Array
        (
            [Is_Hide] => 0
            [Key] => GiSKlOZXRhXTmHKLAeEMPUWoJMs08ftWeenCMrPk
        )

    [2] => Array
        (
            [Is_Hide] => 0
            [Key] => LHo0VTLsFcI7wWq2EWQy1nUp5U13pXWLXt8s0775
        )
)
Michael Benjamin
  • 346,931
  • 104
  • 581
  • 701

1 Answers1

0

You can use PHP's array_map() function:

$input = array_map("unserialize", array_unique(array_map("serialize", $input)));

See this example.

showdev
  • 28,454
  • 37
  • 55
  • 73
Kamlesh Gupta
  • 505
  • 3
  • 17