...
'items' => array_map(function($key) {return array('offer' => array('externalId' => ltrim($key['id'],'0')),'initialPrice' => $key['price'],'quantity' => $key['quantity'],'properties' => array(array('name' => 'sph','value' => (!empty($key['sph']) ? $key['sph'] : '---'))));}, $_GET[CART]);
...
var arrays = [[1, 2, 5], [1,4,7,0], [1,5] ];
var lengths = arrays.map(function(array) {
return array.length;
});
$result = mysqli_fetch_assoc($res)
let promisess = this.distribution.files.map(async(res) => {
return new Promise((resolve, reject) => {
// код
// если код выполнился с ошибкой - reject(), без ошибок - resolve()
});
});
Promise.all(promisess).then(() => {
// все отлично, без ошибок
}).catch(err => {
// Есть ошибка, останавливаем обработку promisess
})
$checker = [];
for($s = 0; $s < count($db_symbol); $s++)
$checker[$s] = 0;
for ($x = 0; $x < 4; $x++){
for($s = 0; $s < count($db_symbol); $s++) {
// код...
// ......
// ......
if ($checker[$s] == 0 && $amount < 7){
$text = "text";
message($text);
$checker[$s] =1;
}
}
}
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://line510.bkfon-resources.com/line/topEvents3?place=live',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_SSL_VERIFYPEER => false
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
6 + 4 - 2 = 8