marz
marz

Reputation: 3

how i fetch data from json output using php

I am having two bank account details,I got this an json format,i want to fetch available balance from this.Here is my sample output:var_dump($result2); I want to get available balances(1423,55158) in each account.I tried this:

        $myArray2 = json_decode($result2,true);
        foreach($myArray2 as $row2) {
                $balance=$row2['itemData']['accounts'];
}
}

i did not get the answer.pls help.

Upvotes: 0

Views: 27

Answers (1)

PrinceG
PrinceG

Reputation: 982

Try this:

foreach($myArray2["itemData"]["accounts"] as $account) {
    $balance = $account['availableBalance']['amount'];
}

Upvotes: 2

Related Questions