Search code examples
phparraysduplicatesarray-unique

removing duplicates from an array in php


I want to remove duplicate elements from an array in php. Following is the structure of the array

Array
(
    [0] => Array
        (
            [0] => [email protected]
            [1] => [email protected]
            [2] => [email protected]
            [3] => [email protected]
            [4] => [email protected]
            [5] => [email protected]
            [6] => [email protected]
            [7] => [email protected]
        )

)

How to go about it ?


Solution

  • http://php.net/manual/en/function.array-unique.php

    $new_unique_array = array_unique($your_array[0]);
    

    Hope that helps, Stefan