note 54829 deleted from language.operators.array by mazzanet
| From: | mazzanet@php.net | Date: | Sat, 16 Jul 2005 12:01:30 +0000 |
| Subject: | note 54829 deleted from language.operators.array by mazzanet | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-92058@lists.php.net to get a copy of this message | ||
Note Submitter: marius dot treitz at i-u dot de
Reason: bad code
----
Get name of month and days in that month from an input 1-12:
<?php
function getMonthInfo() {
global $out;
$cal = getdate();
$month = $cal[mon];
switch($month) {
case 1: $out[d]=31;
$out[n]='January';
break;
case 2: if($cal[year]%4==0) $out[d]=29;
else $out[d]=28;
$out[n]='February';
break;
case 3: $out[d]=31;
$out[n]='March';
break;
case 4: $out[d]=30;
$out[n]='April';
break;
case 5: $out[d]=31;
$out[n]='May';
break;
case 6: $out[d]=30;
$out[n]='June';
break;
case 7: $out[d]=31;
$out[n]='July';
break;
case 8: $out[d]=31;
$out[n]='August';
break;
case 9: $out[d]=30;
$out[n]='September';
break;
case 10: $out[d]=31;
$out[n]='October';
break;
case 11: $out[d]=30;
$out[n]='November';
break;
case 12: $out[d]=31;
$out[n]='December';
break;
}
return $out;
}
?>