首頁 >後端開發 >php教程 >请问一下该如何解析出这个数组呢?谢谢了。

请问一下该如何解析出这个数组呢?谢谢了。

WBOY
WBOY原創
2016-06-23 14:23:13838瀏覽

Array(    [doctorDate] => Array        (            [0] => Array                (                    [doctorOfDate] => 2013-10-02                    [orderingCount] => 12                )             [1] => Array                (                    [doctorOfDate] => 2013-10-03                    [orderingCount] => 8                )         ) )


回复讨论(解决方案)

什么意思?你想做什么

假设数组名为:test
test['doctorDate'][0]['doctorOfDate']=2013-10-02
test['doctorDate'][0]['orderingCount']=12
test['doctorDate'][1]['doctorOfDate']=2013-10-03
test['doctorDate'][1]['orderingCount']=8
这个数组的定义是:

    test=array('doctorDate'=>                    array(0=>array('doctorDate'=>'2013-10-02',                                'orderingCount'=>12),                          1=>array('doctorDate'=>'2013-10-03',                                'orderingCount'=>8)                           )               )

我就想把这个数组的数据显示成:
2013-10-02  12
2013-10-02   8

我就想把这个数组的数据显示成:
2013-10-02  12
2013-10-02   8

Array(    [doctorDate] => Array        (            [0] => Array                (                    [doctorOfDate] => 2013-10-02                    [orderingCount] => 12                )             [1] => Array                (                    [doctorOfDate] => 2013-10-03                    [orderingCount] => 8                )         ) )

<?php$test=array('doctorDate'=>                    array(0=>array('doctorDate'=>'2013-10-02',                                'orderingCount'=>12),                          1=>array('doctorDate'=>'2013-10-03',                                'orderingCount'=>8)                           )               );foreach ($test as $arr){foreach ($arr as $value){echo $value['doctorDate'].'   '.$value['orderingCount'].'<br>';}}?>

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn