3v4l.org

run code in 300+ PHP versions simultaneously
<?php $teamLists = range(1, 32, 1); $group = []; while (!empty($teamLists) && count($group) < 4) { $key = array_rand($teamLists); $group[] = $teamLists[$key]; unset($teamLists[$key]); }

preferences:
38.04 ms | 402 KiB | 5 Q