$str_0 = '';
$str_1 = '';
$str_2 = '';
$y = 0;
for($x = 1; $x <= 30; $x++) {
if($x % 2 !== 0) {
$str_1 .= $x . ',';
} else {
$str_2 .= $x . ',';
}
$y++;
if($y == 10) {
$str_0 .= $str_1 . $str_2;
$str_1 = '';
$str_2 = '';
$y = 0;
}
}
echo substr($str_0, 0, strlen($str_0) - 1);
//1,3,5,7,9,2,4,6,8,10,11,13,15,17,19,12,14,16,18,20,21,23,25,27,29,22,24,26,28,30
$array = [1,2,3,4,5,6,7,8,9,10,11,12];
$a = array_fill(0, count($array)/2, '');
$answer = array_fill(0, count($array), '');
$j=0;
for($i=0; $i<count($array); $i+=2){
$a[$j] = [$array[$i], $array[$i+1]];
$j++;
}
for($i=0; $i<count($a); $i++){
$answer[$i] = $a[$i][0];
$answer[$i+6] = $a[$i][1];
}
print implode(", ", $answer);