How do I access data within this multidimensional array?
Posted
by dmanexe
on Stack Overflow
See other posts from Stack Overflow
or by dmanexe
Published on 2010-04-09T22:21:38Z
Indexed on
2010/04/09
22:23 UTC
Read the original article
Hit count: 372
I have this array:
$items_pool = Array (
[0] => Array ( [id] => 1 [quantity] => 1 )
[1] => Array ( [id] => 2 [quantity] => 1 )
[2] => Array ( [id] => 72 [quantity] => 6 )
[3] => Array ( [id] => 4 [quantity] => 1 )
[4] => Array ( [id] => 5 [quantity] => 1 )
[5] => Array ( [id] => 7 [quantity] => 1 )
[6] => Array ( [id] => 8 [quantity] => 1 )
[7] => Array ( [id] => 9 [quantity] => 1 )
[8] => Array ( [id] => 19 [quantity] => 1 )
[9] => Array ( [id] => 20 [quantity] => 1 )
[10] => Array ( [id] => 22 [quantity] => 1 )
[11] => Array ( [id] => 29 [quantity] => 0 )
)
I'm trying to loop through this array and perform a conditional based on $items_pool[][id]'s value. I want to then report back TRUE or NULL/FALSE, so I'm just testing the presence of to be specific.
© Stack Overflow or respective owner