Re: convert numerical day of week
| From: | Robert Cummings | Date: | Tue, 22 May 2007 23:11:58 +0000 |
| Subject: | Re: convert numerical day of week | ||
| References: | 1 2 3 4 5 6 7 8 9 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-255355@lists.php.net to get a copy of this message | ||
On Tue, 2007-05-22 at 17:54 -0500, Greg Donald wrote:
> On 5/22/07, Robert Cummings <robert@interjinn.com> wrote:
> > Yours is the least maintainable.
>
> Hehe.. with 4 times as many lines of code and 160% more bytes of code overall?
>
> > cat locale.php|grep -v ^$|wc -l
> 16
>
> > cat simple.php|grep -v ^$|wc -l
> 4
>
>
> > ls -lavh
> -rw-r--r-- 1 destiney destiney 347B May 22 17:35 locale.php
> -rw-r--r-- 1 destiney destiney 133B May 22 17:35 simple.php
>
>
> Watch me switch this from English to Spanish:
>
> #$days = array( 'Sunday', 'Monday', 'Tuesday',
> 'Wednesday',
> 'Thursday', 'Friday', 'Saturday' );
> $days = array( 'Domingo', 'Lunes', 'Martes',
> 'Miércoles', 'Jueves',
> 'Viernes', 'Sábado' );
>
> Tada! That was the easiest maintenance programming ever.
Sure, but you need to do that whenever the locale changes. I don't need
to change anything for the weekday names to be portable across all
locales. And yes I know, as you pointed out, the OP didn't say anything
about locale *shrug*. IMHO your solution is still inferior... but I
guess you like it that way.
> > I have nothing to learn from you that I
> > didn't learn in kindergarten.
>
> They didn't teach PHP where I attended kindergarten. Is that a Canadian thing?
Exactly, and I'm not about to learn PHP from you now *lol*.
Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com
|
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'