troubleshooting Question

Find values in multidimensional associative array

Avatar of Colin Brazier
Colin BrazierFlag for United Kingdom of Great Britain and Northern Ireland asked on
PHP
5 Comments1 Solution256 ViewsLast Modified:
Hi experts,

I have been struggling with multidimensional arrays for a while now and have worked out most solutions but I would like your help with this.  Hopefully it's very simple.  I have been as clear as I can but if you have any questions I'll be pleased to explain.

From the attached multidimensional associative array, I need to find each different value of title_team.   They are repeated for each date.  So I just need to look at any instance of the date level (eg. the first one)  but I don't know the key of the date.

At the moment I have this but of course it keeps going through every date!  

Thanks for looking.

Col

    foreach($myArray  as $date => $date1):
       foreach($date1 as $team => $team1):  
            echo $team1['title_team']."<br />";
       endforeach;
    endforeach;

$myArray =

Array
(
    [Saturday February 18 2012] => Array
        (
            [x] => Array
                (
                    [title_team] => xTeam
                    [title_oppo] => Eltham Palace
                    [td_class] => away_game
                )

            [y] => Array
                (
                    [title_team] => yTeam
                    [title_oppo] => To be advised
                    [td_class] => home_game
                )

            [z] => Array
                (
                    [title_team] => zTeam
                    [title_oppo] => State Street
                    [td_class] => away_game
                )
       )

    [Sunday February 19 2012] => Array
        (
            [x] => Array
                (
                    [title_team] => xTeam
                    [title_oppo] => Old Roan
                    [td_class] => home_game
                )

            [y] => Array
                (
                    [title_team] => yTeam
                    [title_oppo] => Heathfield
                    [td_class] => home_game
                )

            [z] => Array
                (
                    [title_team] => zTeam
                    [title_oppo] => Knights
                    [td_class] => away_game
                )
       )
)
ASKER CERTIFIED SOLUTION
Beverley Portlock

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 5 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros