<?php /* example38.php -> tracks tasks to be done for specified days of the week
Created: 5/10/03 by TDavid
*/
function dayInfo($timestamp) {
global 
$pretty_date$day_of_week$future_count$i;
  
$pretty_date date("D, M j, Y"$timestamp); // Saturday, May 10, 2003 
  
$day_of_week date("w"$timestamp);
  switch(
TRUE) {
    case 
$day_of_week == || $day_of_week == || $day_of_week == || $day_of_week == 4:
      
$future_count++;
      return 
true;
    break;
  }
$i--; // do not advance this iteration
return false;
}

$future_days 0// counter of days
$max_days 24// show 6 weeks into the future (4 days [m,tu,w,th] X 6 weeks = 24)
$now time();
$theday $now// start with today

for($i=0$i<$max_days$i++) {
  
$D date("j"$theday); 
  
$M date("g"$theday);
  
$YYdate("Y"$theday);
  
$timestamp mktime(11,0,0$M$D$Y); // 11 = daylight savings offset, start at noon each day
  
if(dayInfo($theday)) {
      
// this is a monday through thursday, so print
      
print("$pretty_date ($day_of_week):<br>");
  }
 
$theday $theday 86400// add 24 hours to clock
}
print(
"<br>Total days: <b>$future_count</b>");
?>