Crimpage Posted August 2, 2007 Share Posted August 2, 2007 Hi Everyone, I have data in an array that looks like this: Array ( [Adelaide] => Array ( [Agriculture] => Array ( [CHAT. MTGE] => Array ( [amtfinanced] => VALUE [numberofdeals] => VALUE [brokerage] => VALUE [docfee] => VALUE ) ) [Transport & Storage] => Array ( [CHAT. MTGE] => Array ( [amtfinanced] => VALUE [numberofdeals] => VALUE [brokerage] => VALUE [docfee] => VALUE ) ) [Agriculture,Forest & Fishing] => Array ( [LEASE] => Array ( [amtfinanced] => VALUE [numberofdeals] => VALUE [brokerage] => VALUE [docfee] => VALUE ) [CHAT. MTGE] => Array ( [amtfinanced] => VALUE [numberofdeals] => VALUE [brokerage] => VALUE [docfee] => VALUE ) ) ) ) And what I need to do, is get the values of the Office Name (Brisbane), Industry (Agriculture), Product(Chat. MTGE), then the values for amt finance, num deals, brokerage, docfee... The info is a report grouped by office, industry then product and I basically just need to get it into Excel. You can see there is a main array (Office), then under that it has an array for each industry, then an array for each product, then the total values will be in there. I also need to get the array key values as these are dynamic and will change. Any ideas would be great. The structure of the array won't change. Cheers, Dave. Quote Link to comment https://forums.phpfreaks.com/topic/62974-get-data-from-this-array/ Share on other sites More sharing options...
teng84 Posted August 2, 2007 Share Posted August 2, 2007 maybe you only need to specify the index where you will get that data like $x[brisbane][Agriculture][CHAT. MTGE] not to get all the value foreach($x[brisbane][Agriculture][CHAT. MTGE] as $xy) echo $xy[amtfinanced]; Quote Link to comment https://forums.phpfreaks.com/topic/62974-get-data-from-this-array/#findComment-313601 Share on other sites More sharing options...
Crimpage Posted August 2, 2007 Author Share Posted August 2, 2007 Hi, Thanks for the quick reply. I also need to get the array key values as these are dynamic. Basically for each row in Excel I will need: Office - Industry - Product - AmtFinanced - NumberofDeals - Brokerage - DocFee Which should look like: Adelaide - Agriculture - Chat. MTGE - $5,000 - 1 - $200 - $50 Adelaide - Agriculture - HP - $10,000 - 2 - $500 - $200 and so on... Cheers, Dave. Quote Link to comment https://forums.phpfreaks.com/topic/62974-get-data-from-this-array/#findComment-313608 Share on other sites More sharing options...
teng84 Posted August 2, 2007 Share Posted August 2, 2007 foreach($x as $key=>$xy) echo $key.''.$xy; something like that Quote Link to comment https://forums.phpfreaks.com/topic/62974-get-data-from-this-array/#findComment-313618 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.