Loading…

How to remove all duplicate values in array in php?

We can use the PHP array_unique() function to remove the duplicate vlaues form an array.

Example

                                        

$array = array("a"=>"best","b"=>"interviewquestion","c"=>"best");
print_r(array_unique($array));

// OUTPUT : Array ( [a] => best [b] => interviewquestion)

Suggest An Answer

No suggestions avaliable!

Latest post from PHP Arrays

Ask Question