我有一个for循环,其中如果le特定日有假期$holiday_result
有1个数组
var_dump($holiday_result);
array (size=1)
0 =>
array (size=6)
'closed' => string 'Closed' (length=6)
'name' => string 'Christmas 2017' (length=14)
'bgcolor' => string '' (length=0)
'color' => string '' (length=0)
'startdate' => string '2017/02/17' (length=10)
'enddate' => string '2017/02/17' (length=10)
array (size=1)
0 =>
array (size=6)
'closed' => string 'Closed' (length=6)
'name' => string 'Christmas 2017' (length=14)
'bgcolor' => string '' (length=0)
'color' => string '' (length=0)
'startdate' => string '2017/02/17' (length=10)
'enddate' => string '2017/02/17' (length=10)
我希望在另一个/最后一行(小时行)之后显示Holiday的一个条件我不知道我是怎么写的。
if ( empty( $holiday_result ) || ( empty( $holiday_result['closed'] ) ) ) {
if (
( strtotime( $iva_curent_time ) >= strtotime( $time->open ) ) &&
( strtotime( $iva_curent_time ) <= strtotime( $time->close ) ) &&
( empty($todayfollowdate[$todaydate]['closed'])) ) {
$out .= '<span class="hours-row"><span class="iva-bh-time">' . $ivbh_arr[ $day ] . '<span class="iva-bh-oc-dot iva_oc_close"></span></span>';
if( $j == 0 ) {
$out .= '<span class="iva_bh_holiday-hrs" ' . $extra . '>' . $holiday_name_var[ $followdate ]['name'] . '</span>';
}
} else {
$out .= '<span class="hours-row"><span class="iva-bh-time">' . $ivbh_arr[ $day ] . '<span class="iva-bh-oc-dot iva_oc_close"></span></span>';
if( $j == 0 ) {
$out .= '<span class="iva_bh_holiday-hrs" ' . $extra . '>' . $holiday_name_var[ $followdate ]['name'] . '</span>';
}
}
}
关于代码输出:
9:00 am-11:00 am
Christmas
1:00 pm-11:00 pm
我想要的是在经过另一个小时的循环之后:
9:00 am-11:00 am
1:00 pm-11:00 pm
Christmas