rossmurphy Posted August 19, 2009 Share Posted August 19, 2009 If i have $apicall['xml'] and 'xml' is an array. How can i access this array without going like this. $xmlarray = $apicall['xml']; $test = $xmlarray['anotherval']; Can't i do something like this? $test = $apicall['xml']->['anotherval'] ?? Quote Link to comment https://forums.phpfreaks.com/topic/171003-accessing-nested-arrays/ Share on other sites More sharing options...
mikesta707 Posted August 19, 2009 Share Posted August 19, 2009 $test = $apicall['xml']['anotherval']; Quote Link to comment https://forums.phpfreaks.com/topic/171003-accessing-nested-arrays/#findComment-901870 Share on other sites More sharing options...
rossmurphy Posted August 19, 2009 Author Share Posted August 19, 2009 Isn't that to access a multidimensional array not an array inside and array? or is it the same thing? Quote Link to comment https://forums.phpfreaks.com/topic/171003-accessing-nested-arrays/#findComment-901889 Share on other sites More sharing options...
TeNDoLLA Posted August 19, 2009 Share Posted August 19, 2009 It is the same thing. Quote Link to comment https://forums.phpfreaks.com/topic/171003-accessing-nested-arrays/#findComment-901890 Share on other sites More sharing options...
rossmurphy Posted August 19, 2009 Author Share Posted August 19, 2009 What about this... I have these arrays $games['slots'] $games['poker'] $games['bingo'] and inside each is another array. When i go like this.. foreach($games['slots'] as $gamesource) { foreach($gamesource as $games) { foreach($games as $game) { echo $game['gameName']; } } } to access the slots array, then i do the same as above again for the poker array...i get and error...invalid foreach?? Quote Link to comment https://forums.phpfreaks.com/topic/171003-accessing-nested-arrays/#findComment-901900 Share on other sites More sharing options...
mikesta707 Posted August 19, 2009 Share Posted August 19, 2009 so you basically have a 4 dimensional array? do print_($games['slots']); but for each of your arrays, and post the output Quote Link to comment https://forums.phpfreaks.com/topic/171003-accessing-nested-arrays/#findComment-901909 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.