I would like to store values from the following $cart_item array:
[addons] => Array(
[0] => Array(
[name] => First Name - First Name
[value] => Gary
[price] =>
)
[1] => Array(
[name] => Church Information - Name
[value] => Victory Bible Church
[price] =>
)
[2] => Array(
[name] => Shirt Size
[value] => XL
[price] =>
)
)
I've realized that I can't grab the value based on the index because this array will sometimes have more sub arrays. For example, I can't use the following string to store data:
$shirt_size = $cart_item['addons'][2]['value'];
Because someone might add into the array the name "Church Information - City" and that will take the array index of [2], which will then make the $shirt_size variable take the 'Church Information - City' value. I don't want that happening.
There are only 2 other possible arrays that will be included. I want to store all possible values associated with a name.
Can someone help me with this?