3v4l.org

run code in 300+ PHP versions simultaneously
<?php header("Content-Type: text/plain; charset=utf-8"); mb_internal_encoding('utf-8'); $total = []; $skip = 5; For ($i=1; $i<31; $i++){ $total[$i-1]=$i; } $schet=0; while (count($total)>= $skip) { foreach ($total as $key => $value) { $schet+=1; If ($schet==5) { unset($total[$key]); $schet=0; } } } echo "Выигрышные места: "; foreach ($total as $key => $value) { echo "$value, "; } ?>
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.6 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.25, 8.4.1 - 8.4.12
Выигрышные места: 3, 4, 14, 27,

preferences:
143.55 ms | 408 KiB | 5 Q