Re: Array mysteries

From: Date: Sun, 11 Mar 2007 10:14:49 +0000
Subject: Re: Array mysteries
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-250220@lists.php.net to get a copy of this message
Steve Edberg wrote:
At 9:51 AM +0100 3/11/07, Otto Wyss wrote:
function convert_from_weekday ($weekday) {
    return $wdays[$weekday];
}
If the above is your exact code, then the problem is one of scope; move the $wdays declaration inside your convert_from_weekday() function. I'm more used to C++ than PHP, with "global $wdays;" it works.
However, you may want to investigate the formatting functions of date(): http://php.he.net/manual/en/function.date.php Date should return names using the native locale; if you want to return date strings for other locales/languages, use setlocale() - http://php.he.net/manual/en/function.setlocale.php
Thanks, I'll keep this in mind. O. Wyss

« previous php.general (#250220) next »