Home > Backend Development > PHP Tutorial > PHP数组取值有关问题

PHP数组取值有关问题

WBOY
Release: 2016-06-13 13:25:39
Original
789 people have browsed it

PHP数组取值问题

PHP code
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->


<?php require_once('Weather_report.php'); ?>

    
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title></title>
    
    
        <?php $weather = new Weather_report();
            $result_array = $weather->get_responseXML();
//            $count = count($result_array["getRegionProvinceResult"]);
            echo $result_array['getRegionProvinceResult']['string'];
        ?>
    


Copy after login


返回结果是如下形式:
Array ( [getRegionProvinceResult] => Array ( [string] => Array ( [0] => 黑龙江,3113 [1] => 吉林,3114 [2] => 辽宁,3115 [3] => 内蒙古,3116 [4] => 河北,3117 [5] => 河南,3118 [6] => 山东,3119 [7] => 山西,31110 [8] => 江苏,31111 [9] => 安徽,31112 [10] => 陕西,31113 [11] => 宁夏,31114 [12] => 甘肃,31115 [13] => 青海,31116 [14] => 湖北,31117 [15] => 湖南,31118 [16] => 浙江,31119 [17] => 江西,31120 [18] => 福建,31121 [19] => 贵州,31122 [20] => 四川,31123 [21] => 广东,31124 [22] => 广西,31125 [23] => 云南,31126 [24] => 海南,31127 [25] => 新疆,31128 [26] => 西藏,31129 [27] => 台湾,31130 [28] => 北京,311101 [29] => 上海,311102 [30] => 天津,311103 [31] => 重庆,311104 [32] => 香港,311201 [33] => 澳门,311202 ) ) )

问题:如何将“江苏,31111”数据依次迭代取出来

------解决方案--------------------
探讨
PHP code






Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template