A Bit of PHP

I feel compelled to reiterate once again that I am really not a programmer, but it is so gratifying when I’m able to solve a problem with a bit of code. So, here’s the code…any ideas on what this does or what my problem was? If you’re good with PHP and see any problems, please let me know!

$calurlyear = date(Y);
$calurlmonth = date(m);
$calurl = ($calurlyear . '/' . $calurlmonth . '/calendar.php');
$i=0;
do {
$i++;
$calurlmonth = str_pad($calurlmonth-1, 2, "0", STR_PAD_LEFT);
if ($calurlmonth < 1){
$calurlmonth = 12;
$calurlyear = $calurlyear-1;
}
$calurl = ($calurlyear . '/' . $calurlmonth . '/calendar.php');
if (file_exists($calurl)){
include $calurl;
$i = 10;
}
}
while ($i < 10);

1 Comment

  1. Geez, all you programmers and nobody figured out what it was yesterday or even that I had an error. That last if statement should have been moved up so that it appears right below the $i++; DoH!

Leave a Comment

Latest Tweet
  • @mariafrey Same here. It’s funny because we started an physical calendar w/ the kids this morning and I didn’t think about it until noon. :)
Somewhat Recent
The Whole Nine Yards