/** * isLastWeek() - returns TRUE if current week is the last week in month * * @param $timestamp * @return (bool) */ function isLastWeek($timestamp){ if(getDayData($timestamp) == weeksInMonth($timestamp)){ return true; } return false; }
insert($toInsert, $seriesID); }else{ break; //quit the loop } } } } }else{ for($x=0;$x<=$totalDays;$x++){ $thisDay = $startDay + $x*$step; # current LOOPED day's timestamp $weekDay = date("w",$thisDay); # number of the day in the week $dayData = getDayData($thisDay); switch($_POST['series_period']){ //every 1st occurence in a month case 1: { if($days[$weekDay]==1 and $dayData['occurence']==1){ # if this date has been validated, use it! insert($thisDay, $seriesID); } break; } //every 2nd occurence in a month case 2: { if($days[$weekDay]==1 and $dayData['occurence']==2){ # if this date has been validated, use it! insert($thisDay, $seriesID); } break;