<p>How can I remove duplicate values from a multi-dimensional array in PHP?</p>

<p>Example array:</p>

<pre><code>Array
(
    [0] =&gt; Array
    (
        [0] =&gt; abc
        [1] =&gt; def
    )

    [1] =&gt; Array
    (
        [0] =&gt; ghi
        [1] =&gt; jkl
    )

    [2] =&gt; Array
    (
        [0] =&gt; mno
        [1] =&gt; pql
    )

    [3] =&gt; Array
    (
        [0] =&gt; abc
        [1] =&gt; def
    )

    [4] =&gt; Array
    (
        [0] =&gt; ghi
        [1] =&gt; jkl
    )

    [5] =&gt; Array
    (
        [0] =&gt; mno
        [1] =&gt; pql
    )

)
</code></pre>

The user comments on the
array_unique()
documentation have many solutions to this. Here is one of them:
kenrbnsn at rbnsn dot com
27-Sep-2005 12:09
Yet another Array_Unique for multi-demensioned arrays. I've only tested this on two-demensioned arrays, but it could probably be generalized for more, or made to use recursion.
This function uses the serialize, array_unique, and unserialize functions to do the work.
```
```
function multi_unique($array) {
    foreach ($array as $k=>$na)
        $new[$k] = serialize($na);
    $uniq = array_unique($new);
    foreach($uniq as $k=>$ser)
        $new1[$k] = unserialize($ser);
    return ($new1);
}
```
```
This is from
http://ca3.php.net/manual/en/function.array-unique.php#57202
.