php chunk arrays into batches
问题 I have an array with say 400 (but could be anything) names i want to send to an API, but the API only receives a max of 200 requests per time, how do i chunk my array so that for every 200th item, i perform an action? Here's what i have so far, rather than making my API request, i'm just trying to output the array's to the page. <?php for ($i = 0; $i <= $smsListLimit; $i++) { if ($i <= 199) { array_push($newarray, $smsList[$i]); if ($i == 199) { echo “ < pre > “; var_dump($newarray); echo “ <