A Sample PHP script to remove all the duplicate values from an array. A running example to remove duplicate array values using PHP

Advertisement

Use PHP array_unique() function to remove all the duplicate values form an array. This function takes input of an array and return another array without duplicate values.

Here is an sample example:

Expected output:

Array
(
    [a] => green
    [1] => blue
    [2] => red
)
Share.
Leave A Reply


Exit mobile version