I'm having hard time wrapping my head around this. I have an array called $a and here's what print_r shows:
Array
(
    [Rows] => Array
     开发者_如何学编程   (
            [Row] => Array
                (
                    [0] => Array
                        (
                            [ContactId] => 26525fea-20c5-43e5-afd2-0001
                        )
                    [1] => Array
                        (
                            [ContactId] => 73b402e6-f7b9-45da-89f4-0002
                        )
                    [2] => Array
                        (
                            [ContactId] => e6a1f356-7838-494b-8e1e-000
                        )
How do I do an echo of just the data in number 2? I just want to output "e6a1f356-7838-494b-8e1e-000". Thanks.
edit: Thanks for the excellent replies. Also, I cant figure out how to do a sizeof of this array? Will I need to write a for loop to go through each until its empty or does sizeof somehow work with this?
Any array variable name can have ['key'] or [N] after it to access a value in the array.  If that value is also an array, you can put another set of [] to access values in that array, which is the next level:
echo $a['Rows']['Row'][2]['ContactId'];
I believe it'd be:
echo $a['Rows']['Row'][2]['ContactId'];
You can traverse/access an array by its keys as shown by the print_r() output.
For example:
echo $a['Rows']['Row'][2]['ConactId'];
                                        
                                        
                                        
                                        
                                        
                                        
                                        
                                        
 加载中,请稍侯......
      
精彩评论