How do you remove duplicates from an array?
We can use the PHP array_unique()
function to remove the duplicate vlaues form an array.
BY Best Interview Question ON 22 Feb 2020
Example
$array = array("a"=>"best","b"=>"interviewquestion","c"=>"best");
print_r(array_unique($array));
// OUTPUT : Array ( [a] => best
[b] => interviewquestion
)