it seems I cant get this one.
I am trying to get a loop from this json output. My aim is the variation values to be separated from the group:
Array
(
[response_description] => 000
[content] => Array
(
[ServiceName] => Gotv Payment
[serviceID] => gotv
[convinience_fee] => N0.00
[varations] => Array
(
[0] => Array
(
[variation_code] => gotv-lite
[name] => GOtv Lite N410
[variation_amount] => 410.00
[fixedPrice] => Yes
)
[1] => Array
(
[variation_code] => gotv-max
[name] => GOtv Max N3,600
[variation_amount] => 3600.00
[fixedPrice] => Yes
)
[2] => Array
(
[variation_code] => gotv-jolli
[name] => GOtv Jolli N2,460
[variation_amount] => 2460.00
[fixedPrice] => Yes
)
[3] => Array
(
[variation_code] => gotv-jinja
[name] => GOtv Jinja N1,640
[variation_amount] => 1640.00
[fixedPrice] => Yes
)
[4] => Array
(
[variation_code] => gotv-lite-3months
[name] => GOtv Lite (3 Months) N1,080
[variation_amount] => 1080.00
[fixedPrice] => Yes
)
[5] => Array
(
[variation_code] => gotv-lite-1year
[name] => GOtv Lite (1 Year) N3,180
[variation_amount] => 3180.00
[fixedPrice] => Yes
)
)
)
)
I tried this and I got the values, but they are in a group, I need them separated in a loop of as in the json output for 0, 1, etc
Here is what I tried:
$array = json_decode($result, true);
//echo '<pre>';print_r(json_decode($result,TRUE));
foreach ($array as $key => $jsons) { // This will search in the 2 jsons
foreach($jsons as $key => $varations) {
foreach($varations as $key => $loop) {
foreach($loop as $key => $value) {
echo $value;
echo "<br><br>";
}
}
}
}
And got this:
gotv-lite
GOtv Lite N410
410.00
Yes
gotv-max
GOtv Max N3,600
3600.00
Yes
gotv-jolli
GOtv Jolli N2,460
2460.00
gotv-lite
GOtv Lite N410
410.00
Yes
gotv-max
GOtv Max N3,600
3600.00
Yes
gotv-jolli
GOtv Jolli N2,460
2460.00
Please someone help your friend. Thanks
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…