3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $campaignIds = array(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17); $limit=3; $blocksCount = count($campaignIds) / $limit; for ($i = 0; $i < $blocksCount; $i++) { echo print_r((array_slice($campaignIds, $blocksCount * $i, $limit))); }
based on AkO8U
Output for 4.3.0 - 5.6.28, hhvm-3.12.0, 7.0.0 - 7.1.0
Array ( [0] => 1 [1] => 2 [2] => 3 ) 1Array ( [0] => 6 [1] => 7 [2] => 8 ) 1Array ( [0] => 12 [1] => 13 [2] => 14 ) 1Array ( ) 1Array ( ) 1Array ( ) 1
Output for hhvm-3.10.0

Process exited with code 153.