【发布时间】:2017-09-26 19:03:54
【问题描述】:
我正在尝试遍历一个多维数组,并不断将头撞在墙上试图弄清楚。 我实际上是在尝试打印 ID 的所有值。
这是我目前所拥有的,但它一直给我一个“数组到字符串转换”的错误。
foreach ($threadsarray as $key => $threads) {
foreach ($threads as $anotherkey => $i) {
foreach($i as $id => $threadid)
echo 'key:'.$key[0]. ' AnotherKey: '.$anotherkey["threads"].' AnotherAnotherKey: '.$i["id"].' value:'.$threadid.'<br>';
}
}
我试图模仿这会做什么,但使用“For循环”
$threadsarray['threads']['0']['id'];
$threadsarray['threads']['1']['id'];
这里是数组.....
Array
(
[threads] => Array
(
[0] => Array
(
[archived] =>
[attachment] =>
[business_purpose] => booking_direct_thread
[id] => 178369845
[inquiry_reservation] =>
[last_message_at] => 2017-04-07T18:52:07Z
[listing] => Array
(
【问题讨论】:
-
然后呢?有什么问题?
标签: php arrays for-loop multidimensional-array