function getData() {
return new Promise(resolve => {
$.getJSON("https://www.cbr-xml-daily.ru/daily_json.js", function(data) {
const kyrs = Math.ceil(100 / data.Valute.KZT.Value * data.Valute.EUR.Value).toString().replace(/(\d)(?=(\d{3})+$)/g, '$1 ');
resolve(kurs);
});
})
}
function func1(kurs) {
console.log(kurs);
}
function func2(kurs) {
console.log(kurs);
}
async function go() {
const kurs = await getData();
$('#euro').html(kyrs);
func1(kurs);
func2(kurs);
}
go();
$item_data = [
[
'barcode' => '656334e3564439',
'stock' => 1,
'warehouseId' => 7543,
]
];
$data = json_encode($item_data);
$sJson = '{"streams":{"stream1":{"alive":0,"iframe":"url" },"stream2":{"alive":0,"iframe":"url"},"stream8":{"alive":0,"iframe":"url"}}}';
$rgJson = json_decode($json, true);
$allDead = true;
foreach($rgJson['streams'] as $stream) {
if ($stream['alive'] != 0) {
$allDead = false;
break;
}
}
if ($allDead) {
echo '1';
}