bschultz Posted June 15, 2013 Share Posted June 15, 2013 The following code ran as true on Friday at 11:45pm...and $showname did not equal anything...anyone know why? if ((($dow != 'Friday' || $dow != 'Saturday') && $hour == '23' && $minute == '45') || $showname == 'livingthecountrylife') This should only run on Sunday, MOnday, Tuesday, Wednesday and Thursday night at 11:45pm...or when run from command line passing the variable Showname the value of livingthecountrylife. The date and time variables are set like this: $year = date('Y'); // 4 digit$month = date('m'); // with leading zeros$date = date('d'); // with leading zeros$dow = date('l'); // Sunday Monday Tuesday...etc$hour = date('H'); // 24 hour with leading zeros$minute = date('i'); // with leading zero$now = date('Y-m-d'); Thanks! Quote Link to comment Share on other sites More sharing options...
mac_gyver Posted June 15, 2013 Share Posted June 15, 2013 because you are using negative logic, you must complement the conditional test OR you could use true logic and complement that expression. either of the following should work (untested) - if ((($dow != 'Friday' && $dow != 'Saturday') && $hour == '23' && $minute == '45') || $showname == 'livingthecountrylife') if ((!($dow == 'Friday' || $dow == 'Saturday') && $hour == '23' && $minute == '45') || $showname == 'livingthecountrylife') Quote Link to comment Share on other sites More sharing options...
Solution bschultz Posted June 15, 2013 Author Solution Share Posted June 15, 2013 That makes sense...thanks! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.