35) \$weeks = 42; else \$weeks = 35; \$output .= " "; \$col=1; //Sets the "pointer" at the first column. \$cur=1; //Sets the number being inserted into a square. \$next=0; //???????????????????????????????????? //For loop that goes through each of the 28, 35, or 42 squares to be in the calendar. for(\$i=1;\$i<=\$weeks;\$i++) { if(\$next==3) \$next=0; if(\$col==1) \$output.=""; //if \$i less than (the number of days in the month + the day of the week the month starts on less 1), //AND it's greater than or equal the day of the week the month starts on, it inserts a number //into the square. Otherwise it inserts a space into the square. if(\$i <= (\$days+(\$start-1)) && \$i >= \$start) { //If the current number being inserted into the square is the same as the same as the day of the month //and the name of the month in \$name is the same as the name of the current month, that particular //square is highlighted differently to indicate "today". if((\$cur==\$today[mday]) && (\$name==\$today[month])) \$output .= " "; \$cur++; //Incriments the current day in the calendar being inserted. \$col++; //Incriments the column currently being used. } //end if else { \$output .= " "; \$col++; //Incriments the column currently being used. } //end else //If \$col has reached 8, that means 7 days have been inserted and the pointer needs to be set to 1. if(\$col==8) { \$output .= ""; \$col=1; \$row++; } //end if } //end for while(\$row <6) { \$output .= " "; \$output .= " "; \$output .= " "; \$output .= " "; \$output .= " "; \$output .= " "; \$output .= " "; \$output .= " "; \$output .= " "; \$row++; } \$output .= "
 \$name \$year2
Su M Tu W Th F Sa
"; else \$output .= " "; \$output .= \$cur . "

"; echo \$output; ?>