I currently have a decoded JSON array
+"productINF": {#1260 ▼
+"product": {#1011 ▼
+"productCode": "123"
+"productType": {#999 ▼
+"count": 3.0
+"desc": "Block"
}
}
}
+"price": {#1267 ▼
+"02": "470.00"
}
And I'm performing multiple foreach loops to get info from each level that I need. The problem is that I have two things on the same level, each their own array: productINF and price.
The first has info on the product and the second has price info. The issue is that in the current JSON array the price is "02" : "470.00" but sometimes there may be multiple prices like so:
+"01": "40.00",
+"05": "240.00"
I don't ever know what the key is going to be but I just want to make sure that foreach item, I call the 2nd value as the price. Here's how I'm looping now, but I don't know how to set the price to a value correctly:
foreach($category->skus as $sku){
foreach($sku->productINF as $info){
$productCode = $info->productCode;
foreach($info->productType as $type){
$count = $type->count;
$desc = $type->desc;
}
}
foreach ($sku->price as $price) {
//Not sure how to access price here
}
}