如何在PHP echo中添加时间限制条件

如何在PHP echo中添加时间限制条件,php,Php,我有这个php代码 }else{ echo apply_filters('wplms_start_quiz_button','<a class="button create-group-button full begin_quiz" data-quiz="'.get_the_ID().'"> '.__('Start Quiz','vibe').'</a>',get_the_ID()); wp_nonce_f

我有这个php代码

}else{
                echo apply_filters('wplms_start_quiz_button','<a class="button create-group-button full begin_quiz" data-quiz="'.get_the_ID().'"> '.__('Start Quiz','vibe').'</a>',get_the_ID());
                 wp_nonce_field('start_quiz','start_quiz');
            }
如果是周四或周五,则==>

echo apply_filters('wplms_start_quiz_button','<a class="button create-group-button full begin_quiz" data-quiz="'.get_the_ID().'"> '.__('Start Quiz','vibe').'</a>',get_the_ID());
                     wp_nonce_field('start_quiz','start_quiz');
                }

使用日期时间。格式N表示一周中的某一天,如下所示:

if(in_array((new DateTime)->format('N'),[3,4])) {   
  .... your code on thursday or friday 
} else {
  ....
}

echo "some string";
if(in_array((new DateTime)->format('N'),[3,4])) {   
  .... your code on thursday or friday 
} else {
  ....
}