Re: [PHP] Newb question about getting keys/values from a single array element

2009-10-09 Thread tedd
At 6:08 PM -0700 10/8/09, Daevid Vincent wrote: I feel like a total newb asking this, but I'm just having a brain fart or something... I'm writing a page where I can either get back a list of items: Array { [1233] = apple, [6342] = apricot, [2345] =

[PHP] Newb question about getting keys/values from a single array element

2009-10-08 Thread Daevid Vincent
I feel like a total newb asking this, but I'm just having a brain fart or something... I'm writing a page where I can either get back a list of items: Array { [1233] = apple, [6342] = apricot, [2345] = banana, ... } where the user then

Re: [PHP] Newb question about getting keys/values from a single array element

2009-10-08 Thread Jonathan Tapicer
One possible solution: ?php $a = array(8575 = 'peach'); list($id, $name) = array_merge(array_keys($a), array_values($a)); echo The ID is $id and the name is $name; ? Prints: The ID is 8575 and the name is peach. Regards, Jonathan On Thu, Oct 8, 2009 at 10:08 PM, Daevid Vincent

Re: [PHP] Newb question about getting keys/values from a single array element

2009-10-08 Thread Paul M Foster
On Thu, Oct 08, 2009 at 06:08:48PM -0700, Daevid Vincent wrote: I feel like a total newb asking this, but I'm just having a brain fart or something... I'm writing a page where I can either get back a list of items: Array { [1233] = apple, [6342] = apricot,