Array Keys and how do I get them?
Posted: Sun Oct 14, 2012 8:20 pm
I have this array setup:
[syntax=text] Array
(
[cart] => Array
(
[0] => Array
(
[item_id] => 1
[item_name] => item name
[price] => 2
[quantity] => 5
)
[1] => Array
(
[item_id] => 3
[item_name] => another item name
[price] => 1
[quantity] => 76
)
[2] => Array
(
[item_id] => 5
[item_name] => yet another item name
[price] => 3
[quantity] => 9
)
)
)[/syntax]
The cart array contains an array for every item inside the cart. What I want is the array key for each item. This is where I'm stuck.
This is probably just me being slow after not writing any code for at least a month, but any guidance is appreciated
[syntax=text] Array
(
[cart] => Array
(
[0] => Array
(
[item_id] => 1
[item_name] => item name
[price] => 2
[quantity] => 5
)
[1] => Array
(
[item_id] => 3
[item_name] => another item name
[price] => 1
[quantity] => 76
)
[2] => Array
(
[item_id] => 5
[item_name] => yet another item name
[price] => 3
[quantity] => 9
)
)
)[/syntax]
The cart array contains an array for every item inside the cart. What I want is the array key for each item. This is where I'm stuck.
This is probably just me being slow after not writing any code for at least a month, but any guidance is appreciated