php 多维数组获取值
2022-08-30 16:59:23
这是我在php中的数组$hotels
Array
(
[0] => Array
(
[hotel_name] => Name
[info] => info
[rooms] => Array
(
[0] => Array
(
[room_name] => name
[beds] => 2
[boards] => Array
(
[board_id] => 1
[price] =>200.00
)
)
)
)
)
我怎么能得到board_id和价格我已经尝试了几个前循环,但无法获得结果
foreach($hotels as $row)
{
foreach($row as $k)
{
foreach($k as $l)
{
echo $l['board_id'];
echo $l['price'];
}
}
}
此代码不起作用。