I’m learning the PFY the basics of php coding.
He’s learning to use the for loop, and I’ve asked him to do some simple practices with formelements for entering dates.
One of the things I asked him, was to make a select field with the twelve months, without entering the names themselves.
He failed at first, but when I showed him one of the ways, I came up with the code below.
And,I think it’s a nice piece of code.

[php]
// set referencedate 01-01-76 in seconds
$referencedate = mktime (0,0,0,1,1,76);

// calculate seconds in a month
$referencemonth = 60*60*24*7*4;

// count to 12
for ($i = 1; $i < =12; $i++) {
// add months to referencedate
$month = $referencedate + ($i * $referencemonth);

// translate seconds to month, display month as sep, jun, may, etc
$month = date(‘M’, $month);

// number of month
echo $i;
//name of month
echo $month;
}
[/php]