1.

How do you remove duplicates from an array?

Answer»

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)



Discussion

No Comment Found