Returning unique values of a multi-dimensional array with CodeIgniter PHP
- by Michael Bradley
Hi - I'm developing a property rentals website. The search results page will contain a list of property results. It is my intention to redefine the results, say by town, country, property type etc.
So let's say for example the user searches 'France'. All of the relative properties will be returned and displayed in a list.
However, I also need to reuse this array, to display only unique town names from the search results array. e.g. Montpellier, Lyon, Rennes, Nice etc. The idea is when use user click on 'Nice', only the 'Nice' properties would return. I would also like to display how many properties are in that town.
The closest example as to what I want to achieve.
http://www.miaandmaggie.com/dog-collars-leashes.html
Any ideas how I can use my search array to display the unique towns of the search?
Many thanks! M