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]

Reply via email to