H-
Thanks to all that wrote in with input on this issue.
I really appreciate the assistance.
Thanks to CC Zona and James for the code sample. It looks like there
were typo's in my code and it threw me for a minute after
recieving/applying all the emails.
That backslash wasn't suppose to be in the original email I sent out, it
was just from my Emacs window wrapping and the = next to Dec became a
problem after I quoted everything else but I found it eventually.
Thanks again. It's now working as I expected it too.
-Sterling
CC Zona wrote:
>
> In article <[EMAIL PROTECTED]>,
> [EMAIL PROTECTED] (Sterling) wrote:
>
> > $m = "03";
> > $list = array(01=>"Jan", 02=>"Feb", 03=>"Mar", 04=>"Apr", 05=>"May",
> > 06=>"Jun", 07=>"Jul", 08=>"Aug", 09=>"Sep\", 10=>"Oct", 11=>"Nov",
> > 12="Dec");
> > $month = $list[$m];
> > print "$month\n";
> >
> > What I want to print is the month in Text format, which in this instance
> > should be Mar .
> > I even tried: $month = array_keys($list, $m);
> >
> > Now I know that $list[x]; references the location of an item so I know
> > why the previous code doesn't work in that respect, since nowhere is 01
> > a location but an association within the array. Right?
>
> The keys to an associative array should be quoted. Also, that escaped
> quote on "Sep\" is throwing everything off. Try:
>
> $m = "03";
> $list = array("01"=>"Jan", "02"=>"Feb", "03"=>"Mar", "04"=>"Apr",
> "05"=>"May", "06"=>"Jun", "07"=>"Jul", "08"=>"Aug", "09"=>"Sep",
> "10"=>"Oct", "11"=>"Nov","12"="Dec");//keys quoted, no escaped quotes
> $month = $list["$m"];//associative array element index quoted
> print "$month\n";
>
> --
> CC
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]