To remove duplicate values from an array using PHP, we have to use the PHP array_unique() function. It removes duplicate values or elements from the array. If our array contains string keys, then this function will keep the first encountered key for every value and will ignore all other subsequent keys.



$var = array("a"=>"best","b"=>"interview","c"=>"question","d"=>"interview");



Array ( [a] => best [b] => interview [c] => question)

Suggest An Answer

No suggestions Available!