简体   繁体   中英

How would I loop through this multidimensional array?

What would be the most efficient way to loop through this multidemsional array? This array is much larger than the example given, and would contain all the visitors ip address who visit my site. Also I would only like to loop through the information contained in 'sc_data'.

 Array
(
[@attributes] => Array
    (
        [status] => ok
    )

[sc_data] => Array
    (
        [0] => Array
            (
                [ip_addresss] => 1
            )

        [1] => Array
            (
                [ip_address] => 1
            )

    )

)

The most efficient way to loop through an array is foreach

foreach($array['sc_data'] as $key => $value) {
    echo $value['ip_addresss'];
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM