skip to Main Content
How To Remove Duplicate Value From The Array Using PHP?

How to remove duplicate value from the array using PHP?

Many time we get the array with contains the duplicate value. how we can find that duplicate value form array and remove it easily. we can remove duplicate value from the array using array_unique()¬†function of PHP. Let’s the example If our array look like.


$array = array(
    "a" => "First",
    "b" => "First",

$array = array_unique($array);
echo '<pre>'; 

The output after removing duplicate value form array is below

 [a] => First
 [0] => Second
 [1] => Third
 [3] => Four

If you have any question write the comment below.


I am a web designer and developer part-time blogger. Write something on some free time. Find my every day thought here :)

Leave a Reply

Your email address will not be published. Required fields are marked *

Back To Top