Re: Array mysteries
| From: | Satyam | Date: | Sun, 11 Mar 2007 11:00:53 +0000 |
| Subject: | Re: Array mysteries | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-250221@lists.php.net to get a copy of this message | ||
----- Original Message ----- From: "Otto Wyss" <otto.wyss@orpatec.ch>
To: <php-general@lists.php.net>
Sent: Sunday, March 11, 2007 11:14 AM
Subject: Re: [PHP] Array mysteries
Steve Edberg wrote:Unless you are using the array elsewhere, it might be a good idea to put it inside the function so as to not polute the global namespace with variable names that have no need to be there. In large applications, there is a non-trivial chance that someone else might use a variable by the same name and ruin your translation table. It will be slightly slower, though. As for the localization functions, you might see their effect in: http://www.satyam.com.ar/int/setlocale/index.php?locale=de_DE&submit=Aceptar the input box allows you to enter different locales, the previous URL already has German selected. SatyamAt 9:51 AM +0100 3/11/07, Otto Wyss wrote:I'm more used to C++ than PHP, with "global $wdays;" it works.function convert_from_weekday ($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.return $wdays[$weekday];}
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.phpThanks, I'll keep this in mind. O. Wyss -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.446 / Virus Database: 268.18.8/717 - Release Date: 10/03/2007 14:25