fork download
  1. <?php
  2.  
  3. function rateOffset($now, $cutoff){
  4. if ($now < strtotime($cutoff)){
  5. return 20.00;
  6. } else {
  7. return 6.00;
  8. }
  9. }
  10.  
  11. $cutoff = "18:56";
  12.  
  13. for ($i = 0; $i < 24; $i++) {
  14. $now = strtotime("$i:00");
  15. $rateCalc = rateOffset($now, $cutoff);
  16. echo date('H:i', $now)." = $rateCalc\n";
  17. }
  18.  
  19. ?>
Success #stdin #stdout 0.01s 13112KB
stdin
Standard input is empty
stdout
00:00 = 20
01:00 = 20
02:00 = 20
03:00 = 20
04:00 = 20
05:00 = 20
06:00 = 20
07:00 = 20
08:00 = 20
09:00 = 20
10:00 = 20
11:00 = 20
12:00 = 20
13:00 = 20
14:00 = 20
15:00 = 20
16:00 = 20
17:00 = 20
18:00 = 20
19:00 = 6
20:00 = 6
21:00 = 6
22:00 = 6
23:00 = 6