K
K
kolomat2020-05-29 18:28:43
PHP
kolomat, 2020-05-29 18:28:43

Why is Yii2 loop not working?

Good afternoon, please advise me on this issue. I am using the http client functions of Yii2 batchSend. To limit the number of requests at a time, I made a cycle of such a plan

$perRequest = 150;
$data = [];
for($i = 0; $i < count($urls); $i += $perRequest) {
      $current = array_slice($urls, $i, $perRequest);
      $data= $client->batchSend($current);
    }

But for some reason, only entries after 100 come in. That is, for example, if 150 urls in the array fall into the data array from 100 to 150, if you use this form
$data[$i] = $client->batchSend($current);
, an empty array generally comes. Do not tell me what could be the problem? Perhaps someone has come across something similar?
UPD in current everything is broken down clearly, 150 pieces each
UPD 2 Question removed

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question