วันศุกร์ที่ 15 ตุลาคม พ.ศ. 2553

array_chunk


<?php

$sumAll = array(
0 => 0.25,
1 => 0.25,
2 => 0.36363636,
3 => 0.36363636,
4 => 0.5,
5 => 0.375,
6 => 0.71428571,
7 => 0.57142857,
);
$sumAll2 = array_chunk($sumAll,4);
$result = array();
foreach($sumAll2 as $four){
$t = 1; foreach($four as $one) $t *= $one; $result[] = $t;
}
echo '<pre>'; print_r($result); echo '</pre>';

?>

ไม่มีความคิดเห็น:

แสดงความคิดเห็น