NYCPHP Meetup

NYPHP.org

[nycphp-talk] Multidimensional Arrays?

harvey list at harveyk.com
Wed Jul 7 13:14:41 EDT 2004


Hello,

I have code that loops through the database and outputs something like the
following:


TEAM 1

Year 1    Year 2     Year 3

8         9          22

TEAM 2

Year 1     Year 2     Year 3

18         94         12

TEAM 3

Year 1     Year 2     Year 3

23         44         45

ALL TEAMS

Year 1     Year 2     Year 3

??         ??         ??


I can't figure out how to easily get the ?? totals. I think I want a major
array of three minor arrays (I probably just invented my own vocabulary):
the major array would increment by one each year; the three minor arrays
would hold the Year 1 values, Year 2 values, and Year 3 values.
Conceptually, it would be something like $all_teams[$year_id][ ]. Is
something like that possible? I know that php allows multidimensional
arrays, but I guess I don't know the proper syntax or usage.

Thanks in advance for any help!

Harvey





More information about the talk mailing list