How do I get data of an array in an array?


#1

[php]
echo “

”;
foreach ($standings[“Pacific”][“delta”] as $value1) {
foreach ($standings[“Pacific”][“delta”][$value1] as $value2) {
echo $value2."    ";
}
echo “
”;
}
echo “
”;
[/php]

Whats wrong with this code? :frowning: , like this:

[php]

The array structure is as follows:

(Using Pacific conference, Delta division, 001 team ID and Team_Name as examples)

$standings => Array

(

[Pacific] => Array

(

[delta] => Array

(

[001] => Array

(

[NAME] => Team_Name

[POINTS] => 1

[PF] => 1

[WINS] => 1

[LOSES] => 1

[TIES] => 1

[PCT] => 1.00

[ID] => 1-1

[OD] => 1-1

)

)

)

)

The first level of the array is the Conference.

Possible values: [Pacific, Central, Atlantic]

The second level of the array is the Division.

Possible values: [Delta, Omega, Theta, Gamme, Unasigned]

The third level of the array is the Team or Member Info (depending on Division)

#============================================================================================
[/php]

You can find all the php codeand XML file that the data is parsed from here:
http://www.caleague.com/standings_xml_parse.phps
http://www.caleague.com/data/div_cso/standings.xml

How would I get the data out of the array to display an HTML table like this:

Conference: Pacific
Division: Delta
--------------------------------
Team Wins Losses etc…
--------------------------------
Team1 1 0 …
Team 2 0 1 …
_______________________

#2

Wow a 4 dimensional array… Cool.

I beleive that it is taking the value found at $standings[“Pacific”][“delta”] and moving it into the array $value1. so now you have to access it as you would a standard array

$value1[0],$value1[1],$value1[2],$value1[3], ect.

So
foreach ($value1 as $value2) {
echo $value2."    ";
}

Make sense?