[PHP] the numeric key of an array???

2002-12-20 Thread Alexander Guevara
How can i do for printing the value of an array given the numeric key for example i have this code: $array = array ( 'VAL1' = VALUE1, 'VAL2' = VALUE2, 'VAL3' = VALUE3 ) So the only way i have found to print the value is like this : echo $array['VAL1']; and it prints = VALUE1 but

RE: [PHP] the numeric key of an array???

2002-12-20 Thread John W. Holmes
How can i do for printing the value of an array given the numeric key for example i have this code: $array = array ( 'VAL1' = VALUE1, 'VAL2' = VALUE2, 'VAL3' = VALUE3 ) So the only way i have found to print the value is like this : echo $array['VAL1']; and it prints

Re: [PHP] the numeric key of an array???

2002-12-20 Thread Philip Olson
No, but you can do this: $arr2 = array_values($array); print $arr2[0]; // VALUE1 Regards, Philip Olson On Fri, 20 Dec 2002, Alexander Guevara wrote: How can i do for printing the value of an array given the numeric key for example i have this code: $array = array ( 'VAL1' =

Re: [PHP] the numeric key of an array???

2002-12-20 Thread Alexander Guevara
Well which kind of methods are you talking about?? could you tell me some for do it?? Thanks! John W. Holmes [EMAIL PROTECTED] wrote in message 01c2a890$d1539cf0$7c02a8c0@coconut">news:01c2a890$d1539cf0$7c02a8c0@coconut... How can i do for printing the value of an array given the

Re: [PHP] the numeric key of an array???

2002-12-20 Thread Alexander Guevara
Yeah this workes fine.. thanks!! Philip Olson [EMAIL PROTECTED] wrote in message Pine.BSF.4.10.10212210135051.36987-10@localhost">news:Pine.BSF.4.10.10212210135051.36987-10@localhost... No, but you can do this: $arr2 = array_values($array); print $arr2[0]; // VALUE1 Regards,

RE: [PHP] the numeric key of an array???

2002-12-20 Thread John W. Holmes
If you're looking to loop through your array, there are other methods. Well which kind of methods are you talking about?? could you tell me some for do it?? foreach($array as $key=$value) www.php.net/foreach while(list($key,$value) = each($array) www.php.net/each www.php.net/list $cnt =

Re: [PHP] the numeric key of an array???

2002-12-20 Thread Alexander Guevara
Thanks. it worked fine.. and the reply at the botton too.. Thank you so much! John W. Holmes [EMAIL PROTECTED] wrote in message 000101c2a896$70aad5c0$7c02a8c0@coconut">news:000101c2a896$70aad5c0$7c02a8c0@coconut... If you're looking to loop through your array, there are other methods.