have a json
stored in database having unknown keys
.
i want to print them like this
array_key : amount
for first array key => cigratte_flake, Amount => 2997
here is my decoded json
stdClass Object
(
[cigratte_flake] => Array
(
[0] => stdClass Object
(
[Price] => 999
[Quantity] => 3
[Amount] => 2997
)
)
[wrestling_board] => Array
(
[0] => stdClass Object
(
[Price] => 400
[Quantity] => 2
[Amount] => 800
)
)
[flex_board_naga_dhaga] => Array
(
[0] => stdClass Object
(
[Price] => 300
[Quantity] => 2
[Amount] => 600
)
)
[total] => Array
(
[0] => stdClass Object
(
[Price] =>
[Quantity] =>
[Amount] => 4397
)
)
)
here is my original json:
{"cigratte_flake":[{"Price":"999","Quantity":"3","Amount":"2997"}],"wrestling_board":[{"Price":"400","Quantity":"2","Amount":"800"}],"flex_board_naga_dhaga":[{"Price":"300","Quantity":"2","Amount":"600"}],"total":[{"Price":null,"Quantity":null,"Amount":"4397"}]}
i know this below code, but don't know how to apply in foreach loop, other solution is most appreciated
reset($a);
$first_key = key($a);
Please help me thanks in advance!!!