php – Foreach数组内的数组

我有一个数组,我做了一个print_r,它返回了这个……

Array ( [0] => Array ( [invoiceid] => 2 [client] => Test 1 [invoicedeliverymethod] => email [paymenttimeallotment] => 15 [clientid] => 1 [date] => 2012-04-12 [enddate] => 2012-04-02 00:00:00 [total] => 250.86 [remainingbalance] => 250.86 [ispaid] => No [isagentpaid] => No [datedistributed] => Not distributed [invoicedcontact] => 1 ) [1] => Array ( [invoiceid] => 1 [client] => Test 1 [invoicedeliverymethod] => email [paymenttimeallotment] => 15 [clientid] => 1 [date] => 2012-04-12 [enddate] => 2012-03-31 23:59:59 [total] => 602.29 [remainingbalance] => 602.29 [ispaid] => No [isagentpaid] => No [datedistributed] => 2012-04-12 [invoicedcontact] => 1 ) )

我试着运行这段代码……

 foreach($resultArray as $row => $value){
    echo $value . "<br/>";
}

并返回了Array Array.

如何获取这些数组中的值?

解决方法:

您需要迭代内部数组中的元素,如下所示:

foreach($resultArray as $row => $innerArray){
  foreach($innerArray as $innerRow => $value){
    echo $value . "<br/>";
  }
}

相关文章

统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
前言 之前做了微信登录,所以总结一下微信授权登录并获取用户...
FastAdmin是我第一个接触的后台管理系统框架。FastAdmin是一...
之前公司需要一个内部的通讯软件,就叫我做一个。通讯软件嘛...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...