Here is my problem. I have an api that returns an array, $services. This command: print_r($services); produces this: Array ( [blogger] => Array ( [name] => Blogger [methods] => Array ( [0] => blog [1] => images ) ) [posterous] => Array ( [name] => Posterous [methods] => Array ( [0] => blog [1] => microblog [2] => status [3] => images ) ) [tumblr] => Array ( [name] => Tumblr [methods] => Array ( [0] => blog [1] => images ) ) [typepad] => Array ( [name] => TypePad [methods] => Array ( [0] => blog [1] => microblog [2] => status ) ) [vox] => Array ( [name] => Vox [methods] => Array ( [0] => blog ) ) [wordpress] => Array ( [name] => WordPress.com [methods] => Array ( [0] => blog [1] => microblog [2] => status ) ) [xanga] => Array ( [name] => Xanga [methods] => Array ( [0] => blog [1] => microblog [2] => status ) ) ) My question is this - how do I programmatically get to the strings in the [methods] strings above array, ie 'blog' , 'microblog', 'status'
If you want to access them just one time, you can use something like $services["blogger"]["methods"][0], $services["blogger"]["methods"][1], etc. BUt if you want to loop through all of them, go for foreach()