PHP Array: Remove Duplicates Easily

You can use the array_unique() function in PHP to remove duplicates from a one-dimensional array. This function will return a new array with duplicate values removed. Here is an example code:

$array = array("a", "b", "c", "a", "b", "d");
$uniqueArray = array_unique($array);

print_r($uniqueArray);

The code above will produce:

Array
(
    [0] => a
    [1] => b
    [2] => c
    [5] => d
)
bannerAds