3v4l.org

run code in 500+ 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 8.4.9 - 8.4.28, 8.5.0 - 8.5.12
Выигрышные места: 3, 4, 14, 27,

preferences:
22.87 ms | 1164 KiB | 6 Q