1 回答
TA贡献1803条经验 获得超6个赞
您需要在 中分离出每个数组的键和值;然后你可以迭代它们。请注意,此代码假定日期数与位置相同:$tourAvaibilityDate['tour_avaibility']
$tours = $tourAvaibilityDate['tour_avaibility'];
$start_locations = array_keys($tours['tour_avaibility_location']);
$end_locations = array_values($tours['tour_avaibility_location']);
$start_dates = array_keys($tours['tour_avaibility_date']);
$end_dates = array_values($tours['tour_avaibility_date']);
$c = count($start_locations);
for ($i = 0; $i < $c; $i++) {
echo $start_locations[$i] . ' - ' . $end_locations[$i] . "\n";
echo $start_dates[$i] . ' - ' . $end_dates[$i] . "\n";
}
输出(对于示例数据):
Location_one - Location_two
02/11/2020 - 02/17/2020
Location_seven - Location_nine
02/21/2020 - 02/26/2020
- 1 回答
- 0 关注
- 108 浏览
添加回答
举报