<?php
$total = 30;
$skip = 5;
$a = 1;
foreach ($totalAr as &$value){
$value += $a;
$a++;
}
$e = 0;
while(count($totalAr) >= $skip) { foreach ($totalAr as $k => $v) {
$e++;
if ($e == $skip) {
$e = 0;
}
}
}
print "Чай пьют " . implode(', ', $totalAr);
PD9waHAKZXJyb3JfcmVwb3J0aW5nKC0xKTsKbWJfaW50ZXJuYWxfZW5jb2RpbmcoJ3V0Zi04Jyk7CgokdG90YWwgPSAzMDsKJHNraXAgPSA1OwoKJHRvdGFsQXIgPSBhcnJheV9maWxsKDEsICR0b3RhbCwgMCk7CiRhID0gMTsKZm9yZWFjaCAoJHRvdGFsQXIgYXMgJiR2YWx1ZSl7CiAgICAkdmFsdWUgKz0gJGE7CiAgICAkYSsrOwp9CgokZSA9IDA7CndoaWxlKGNvdW50KCR0b3RhbEFyKSA+PSAkc2tpcCkgewogICAgZm9yZWFjaCAoJHRvdGFsQXIgYXMgJGsgPT4gJHYpIHsKICAgICAgICAkZSsrOwogICAgICAgIGlmICgkZSA9PSAkc2tpcCkgewogICAgICAgICAgICB1bnNldCgkdG90YWxBclska10pOwogICAgICAgICAgICAkZSA9IDA7CiAgICAgICAgfQogICAgfQp9CgpwcmludCAi0KfQsNC5INC/0YzRjtGCICIgLiBpbXBsb2RlKCcsICcsICR0b3RhbEFyKTs=