Array (
[0] => Array (
[product_id] => 111
[offer_id] => AR-001
[stocks] => Array (
[1] => Array (
[type] => fbs
[present] => 10
[reserved] => 0
)
)
)
[1] => Array (
[product_id] => 222
[offer_id] => AR-002
[stocks] => Array (
[0] => Array (
[type] => fbs
[present] => 0
[reserved] => 0
)
)
)
)
foreach ($items as &$item) {
$item['stocks'] = array_values(array_filter(
$item['stocks'],
fn($el) => $el['type'] === 'fbs'
));
}
context to-mobile {
_X. => {
&start-record();
route=${ODBC_MNCRoute(${EXTEN})};
if ("${route}" = "") {
&mobile-route-by-def(${EXTEN});
route=${GOSUB_RETVAL};
}
switch(${route}) {
case tele2:
&ext-call(tele2-mobile+rtk+pstn,${EXTEN});
break;
case rtk:
&ext-call(rtk-mobile+rtk+pstn,${EXTEN});
break;
case mts:
&ext-call(mts-mobile+rtk+pstn,${EXTEN});
break;
case sipnet:
&ext-call(sipnet+rtk+pstn,${EXTEN});
break;
default:
&ext-call(rtk-mobile+rtk+pstn,${EXTEN});
break;
}
HangUp;
}
}
[to-mobile]
exten => sw_80_, 10, Goto(sw_80_.,10)
exten => sw_80_mts, 10, Gosub(ext-call,~~s~~,1(mts-mobile+rtk+pstn,${~~EXTEN~~}))
exten => sw_80_mts, 11, Goto(_X.,9)
exten => sw_80_rtk, 10, Gosub(ext-call,~~s~~,1(rtk-mobile+rtk+pstn,${~~EXTEN~~}))
exten => sw_80_rtk, 11, Goto(_X.,9)
exten => sw_80_sipnet, 10, Gosub(ext-call,~~s~~,1(sipnet+rtk+pstn,${~~EXTEN~~}))
exten => sw_80_sipnet, 11, Goto(_X.,9)
exten => sw_80_tele2, 10, Gosub(ext-call,~~s~~,1(tele2-mobile+rtk+pstn,${~~EXTEN~~}))
exten => sw_80_tele2, 11, Goto(_X.,9)
exten => _sw_80_., 10, Gosub(ext-call,~~s~~,1(rtk-mobile+rtk+pstn,${~~EXTEN~~}))
exten => _sw_80_., 11, Goto(_X.,9)
exten => _X., 1, MSet(~~EXTEN~~=${EXTEN})
exten => _X., 2, Gosub(start-record,~~s~~,1)
exten => _X., 3, MSet(route=$[${ODBC_MNCRoute(${~~EXTEN~~})}])
exten => _X., 4, GotoIf($["${route}" = ""]?5:7)
exten => _X., 5, Gosub(mobile-route-by-def,~~s~~,1(${~~EXTEN~~}))
exten => _X., 6, MSet(route=$[${GOSUB_RETVAL}])
exten => _X., 7, NoOp(Finish if_to-mobile_79)
exten => _X., 8, Goto(sw_80_${route},10)
exten => _X., 9, NoOp(Finish switch_to-mobile_80)
exten => _X., 10, HangUp()
как их вывести за logN?Никак.
<
использовать<