hey guys i have an array in php and it contains some records twice, trice or so. I only want to list those records once while fetching array elements. eg. "entry 1" comes five times in the array then i want to display it only once and then next element. if i give print_r($array) comment then it show results like this.
Array ( [0] => Nueva Andalucia [1] => Nueva Andalucia [2] => Marbella East [3] => Golden Mile [4] =>

can anyone tell how to do this?


Recommended Answers

All 2 Replies

$onlyone = array_unique($array);

gets rid of all duplicates

now only one is a array and doesnt have duplicates

Yes, That did work. Thanks for reply. You seems to be an expert. :-)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.