Answer the question
In order to leave comments, you need to log in
How to search in multidimensional array?
How to output "amount": 8.74 where value key is "alias": "qw_wallet_rub"?
{
"accounts": [
{
"alias": "mc_beeline_rub",
"fsAlias": "qb_mc_beeline",
"bankAlias": "QIWI",
"title": "MC",
"type": {
"id": "MC",
"title": "Счет мобильного кошелька"
},
"hasBalance": false,
"balance": null,
"currency": 643
},
{
"alias": "qw_wallet_rub",
"fsAlias": "qb_wallet",
"bankAlias": "QIWI",
"title": "WALLET",
"type": {
"id": "WALLET",
"title": "QIWI Wallet"
},
"hasBalance": true,
"balance": {
"amount": 8.74,
"currency": 643
},
"currency": 643
}
]
}
Answer the question
In order to leave comments, you need to log in
Maybe it's better to redo the routing system and issue the first match? Then it will be enough just to prescribe /admin before the regexp. Or even use a ready-made library for routing, since there are a lot of them.
Or create a admin rule like '/admin/?'
or reconsider the "architecture" of virtual addresses and exclude global addresses like /anything
and do something like this:
/users/anything
/products/anything
/articles/anything
Two nested within each other foreach
. The first one searches "alias": "qw_wallet_rub"
and passes execution to the nested foraech
, which will already be searched in "balance"
, for this you will need to make a condition so that it does not iterate over the entire json.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question