troubleshooting Question

Loop through multi dimensional array

Avatar of KOvitt
KOvittFlag for United States of America asked on
12 Comments1 Solution357 ViewsLast Modified:
I have a multi dimensional array in PHP that includes

Array([0] => Array ( [0] => Week 10 - 2011 [1] => 384266.0 [2] => APPL))
Array([1] => Array ( [0] => Week 10 - 2011 [1] => 364266.0 [2] => BLK))

A Date in the first element on the imbedded array, volume in the second and a ticker in the third.

My array can be up to 6000ish long. And Dates repeat for different tickers, and tickers repeat for different dates.

The dates can be either days, weeks, months, Quarters or years

I want to loop through the array and display it in an html table with the following format

                Date1    Date2    Date3    Date4  ....
Ticker1   Volume  Volume  Volume  Volume
Ticker2   Volume  Volume  Volume  Volume
Ticker3   Volume  Volume  Volume  Volume
Ticker4   Volume  Volume  Volume  Volume
...           ...           ....          ....          ....

It displays the ticker on the y axis and the date on the x. Then displays the volume for the corresponding ticker on that date.

How would I loop through the array to do this?



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 12 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 12 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