results only show inside a foreach
i'm trying to grab the quantity of products in my session array but for
some reason if i have the below code it does not work
$amount = $array->products['quantity'];
I use the code below to get the zip out if the array - the array is a
multidimensional array
$amount = $array->products['quantity'];
But if i use a foreach i get the results i need (see below)
Foreach($array->products as $product){
$amount = $product->quantity;
echo $amount;
}
The problem is i have a foreach that calculates shipping rates and it
needs the quantity to multiple with the weight,so i can't use the above
foreach because the calculator uses a different one,
Please note: i'm new to php any help will be so great.
Does the array need to loop though to get the results or is it something
i'm missing?
Thanks for reading.
No comments:
Post a Comment