Jun 17, 2007

Check and Remove Duplicate Values from PHP Array

Thanks for visiting.

3 Comments:

Mahesh Dada said...

hi thank you i get proper array but how i also change the key of my array
ex. $arr=array(0=>2, 1=>2, 2=>4, 3=>4);
$arr=array_unique($arr);

o/p:
array(0=>2, 3=>4);

here i want
array(0=>2, 1=>4);

satyakaran said...

Try with print_r(array_values(array_unique($arr)));

rupesh said...

hi satya prakash
It was nice to read ur code for checking duplicate values in array.

Thanks
rupesh
PHP developer
Gurgaon, India

 
Privacy Policies
Blogroll