php - How to use OR function in a statement -
i want set $a = 5
between 09.00h , 16.59h, monday friday.
$time = time()%86400; if( (date("d") == "mon") || (date("d") == "tue") || (date("d") == "wed") || (date("d") == "thu") || (date("d") == "fri") && $time >= 32400 && $time <= 61119){ $a = 5; }
have && time read @ end? read "mon or tue or wed or thu or fri..." , "time...", or instead "fri , time"?
you're close, you'll need set of parenthesis around ors, cleaner way write might be:
if( in_array((date("d"), array("mon","tue","wed","thu","fri")) && $time >= 32400 && $time <= 61119 ){
or even:
!in_array((date("d"), array("sat","sun"))
Comments
Post a Comment