return unique values from array

Posted by Brad on Stack Overflow See other posts from Stack Overflow or by Brad
Published on 2013-11-11T21:47:29Z Indexed on 2013/11/11 21:53 UTC
Read the original article Hit count: 198

Filed under:
|

I have an array that contains cities, I want to return an array of all those cities, but it must be a unique list of the cities.

The array below:

Array
(
    [0] => Array
        (
            [eventname] => Wine Tasting
            [date] => 12/20/2013
            [time] => 17:00:00
            [location] => Anaheim Convention Center
            [description] => This is a test description
            [city] => Anaheim
            [state] => California
        )

    [1] => Array
        (
            [eventname] => Circus
            [date] => 12/22/2013
            [time] => 18:30:00
            [location] => LAX
            [description] => Description for LAX event
            [city] => Anaheim
            [state] => California
        )

    [2] => Array
        (
            [eventname] => Blues Fest
            [date] => 3/14/2014
            [time] => 17:00:00
            [location] => Austin Times Center
            [description] => Blues concert
            [city] => Austin
            [state] => Texas
        )

)

Should return:

array('Anaheim', 'Austin');

Any help is appreciated.

© Stack Overflow or respective owner

Related posts about php

Related posts about arrays