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);

One comment on “A Bit of PHP

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 Reply

Your email address will not be published. Required fields are marked *

Back to the top!