[ create a new paste ] login | about

Link: http://codepad.org/uaY1ziEI    [ raw code | output | fork ]

PHP, pasted on Oct 15:
1
2
3
4
5
6
7
8
9
<?php

$arr = array_chunk(array(1,2,3,4,5,6,7,8,9), 3);

while ($chunk = array_shift($arr)) {
    echo array_sum($chunk) / count($chunk) . PHP_EOL;
}

?>


Output:
1
2
3
2
5
8


Create a new paste based on this one


Comments: