Re: Array mysteries

From: Date: Mon, 12 Mar 2007 23:14:06 +0000
Subject: Re: Array mysteries
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-250347@lists.php.net to get a copy of this message
Read the manual again, especially the part about "variable scope" near the beginning. On Sun, March 11, 2007 3:51 am, Otto Wyss wrote: > I want to convert weekdays with a simple function like > > $wdays = array > (0 => "Sonntag" > ,1 => "Montag" > ,2 => "Dienstag" > ,3 => "Mittwoch" > ,4 => "Donnerstag" > ,5 => "Freitag" > ,6 => "Samstag" > ); > > function convert_from_weekday ($weekday) { > return $wdays[$weekday]; > } > > but this doesn't work while > > $wdays[$weekday]; > > outside of the function works correct. Has anybody an idea where's my > mistake? I'd like to use a function so I may return substrings of the > weekday. > > O. Wyss > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So?

« previous php.general (#250347) next »