Answer the question
In order to leave comments, you need to log in
How to use the required array in JSON?
My JSON has multiple arrays. How to use the value of one array to make it clear that further sampling should be done from it?
json example
{
"data":[
{
"txnId":12615777480,
"personId":777777,
"date":"2018-04-01T21:01:51+03:00",
"errorCode":0,
"error":null,
"status":"SUCCESS",
"type":"IN",
"statusText":"Success",
"trmTxnId":"322605711",
"account":"+7666666",
"sum":{
"amount":1,
"currency":643
},
"commission":{
"amount":0,
"currency":643
},
"total":{
"amount":1,
"currency":643
},
"provider":{
"id":7,
"shortName":"QIWI Кошелек",
"longName":"QIWI Кошелек",
"logoUrl":null,
"description":null,
"keys":"мобильный кошелек, кошелек, перевести деньги, личный кабинет, отправить деньги, перевод между пользователями",
"siteUrl":null,
"extras":[
]
},
"source":null,
"comment":"77098646",
"currencyRate":1,
"paymentExtras":[
],
"features":{
"chequeReady":false,
"bankDocumentReady":false,
"regularPaymentEnabled":false,
"bankDocumentAvailable":false,
"repeatPaymentEnabled":false,
"favoritePaymentEnabled":false,
"greetingCardAttached":false
},
"serviceExtras":{
},
"view":{
"title":"QIWI Кошелек",
"account":"+7666666"
}
},
{},
{},
{},
{},
{},
{},
{},
{},
{
"txnId":12463731627,
"personId":7777777,
"date":"2018-03-10T10:34:19+03:00",
"errorCode":0,
"error":null,
"status":"SUCCESS",
"type":"IN",
"statusText":"Success",
"trmTxnId":"320667259",
"account":"+76666666",
"sum":{
"amount":1,
"currency":643
},
"commission":{
"amount":0,
"currency":643
},
"total":{
"amount":1,
"currency":643
},
"provider":{
"id":7,
"shortName":"QIWI Кошелек",
"longName":"QIWI Кошелек",
"logoUrl":null,
"description":null,
"keys":"мобильный кошелек, кошелек, перевести деньги, личный кабинет, отправить деньги, перевод между пользователями",
"siteUrl":null,
"extras":[
]
},
"source":null,
"comment":"56732049",
"currencyRate":1,
"paymentExtras":[
],
"features":{
"chequeReady":false,
"bankDocumentReady":false,
"regularPaymentEnabled":false,
"bankDocumentAvailable":false,
"repeatPaymentEnabled":false,
"favoritePaymentEnabled":false,
"greetingCardAttached":false
},
"serviceExtras":{
},
"view":{
"title":"QIWI Кошелек",
"account":"+76666666"
}
}
],
"nextTxnId":12461755984,
"nextTxnDate":"2018-03-09T22:16:42+03:00"
}
$comment = 77098646;
$results = array_filter($object['data'], function ($item) use ( $comment ) {
return $item['comment'] == $comment;
});
$status = $results ? 1 : 0;
if($status == 1){
echo '<br/>=)';
}
else
{
echo '<br/>=(';
}
comment
equal 77098646
, how to make it clear that further sampling should be done here? not where comment
equal56732049
$results1 = array_filter($object['data'], function ($item1) use ( $amount, $comment) {
return $item1['sum']['amount'] == $amount and $comment;
});
//var_dump($results1);
$status1 = $results1 ? 1 : 0;
if($status1 == 1){
echo '<br/>=))';
}
else
{
echo '<br/>=((';
}
Answer the question
In order to leave comments, you need to log in
If comment is equal to 77098646 how to make it clear that further sampling should be done here?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question