Re: list of Months
| From: | Paul Bissex | Date: | Fri, 01 Oct 2004 15:44:26 +0000 |
| Subject: | Re: list of Months | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-198439@lists.php.net to get a copy of this message | ||
On Fri, 01 Oct 2004 10:30:19 +0200, Marek Kilimajer <lists@kilimajer.net> wrote:
> What about dumping the $month_names array and using strftime()?
Interesting -- more portable since the month names would then follow
locale settings.
Plus it paves the way for a really hairy one-liner. With apologies to
the original poster for the drift and the perversity of this example:
<?php
print"<select
name='QuoteMonth'>".implode("\n",array_map(create_function('$n','return"<option
value=\"$n\"".(date("n")==$n?"
selected=\"selected\"":"").">".strftime("%b",strtotime("2004-$n-01"))."</option>";'),range(1,12)))."</select>";
?>
--
paul bissex, e-scribe.com -- database-driven web development
413.585.8095
69.55.225.29
01061-0847
72°39'71"W 42°19'42"N