2

I have an array like this:

 Array
 (
 [0] => Array
    (
        [0] => Array
            (
                [Foo] => FooBar
            )

    )

[1] => Array
    (
        [0] => Array
            (
                [Foo] => BarFoo
            )
    )

[2] => Array
    (
        [0] => Array
            (
                [Foo] => FooFoo
            )

    )

[3] => Array
    (
        [0] => Array
            (
                [Foo] => FooFoo
            )

    )

)

I basically want to be able to look at [2] and [3] and be able to merge those two together since their values are the same. Basically I just don't want to double count. Is there a simple way of doing this while looping through?

ScaisEdge
  • 131,976
  • 10
  • 91
  • 107
codnor
  • 131
  • 1
  • 8

1 Answers1

2

You can try this

$unique_array = array_map("unserialize",
      array_unique(array_map("serialize", $your_array)));
ScaisEdge
  • 131,976
  • 10
  • 91
  • 107