本文整理汇总了PHP中CMbArray::average方法的典型用法代码示例。如果您正苦于以下问题:PHP CMbArray::average方法的具体用法?PHP CMbArray::average怎么用?PHP CMbArray::average使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CMbArray
的用法示例。
在下文中一共展示了CMbArray::average方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
$operations = $ds->loadList($sql);
$old_plagesop = 0;
$old_operation_id = 0;
$nb_oper_par_plage = 0;
$nb_plage[$_prat->user_id] = 0;
$preparation[$_prat->user_id] = array();
foreach ($operations as $keyOp => $curr_op) {
if ($old_operation_id and $old_plagesop == $curr_op["plageop_id"]) {
$testValid = 30 * 60 > $curr_op["sec_entree"] - $operations[$old_operation_id]["sec_sortie"];
$testValid = $testValid && $operations[$old_operation_id]["sec_sortie"] < $curr_op["sec_entree"];
if ($testValid) {
$preparation[$_prat->user_id][] = $curr_op["sec_entree"] - $operations[$old_operation_id]["sec_sortie"];
$nb_oper_par_plage++;
if ($nb_oper_par_plage == 1) {
$nb_plage[$_prat->user_id] = $nb_plage[$_prat->user_id] + 1;
}
}
} else {
$nb_oper_par_plage = 0;
}
$old_operation_id = $keyOp;
$old_plagesop = $curr_op["plageop_id"];
}
if (count($preparation[$_prat->user_id])) {
// Mémorisation des données dans MySQL
$sql = "INSERT INTO `temps_prepa` (`temps_prepa_id`, `chir_id`, `nb_prepa`, `nb_plages`, `duree_moy`, `duree_ecart`)\r\n VALUES (NULL, \r\n '{$_prat->user_id}',\r\n '" . count($preparation[$_prat->user_id]) . "',\r\n '" . $nb_plage[$_prat->user_id] . "',\r\n '" . strftime("%H:%M:%S", CMbArray::average($preparation[$_prat->user_id])) . "',\r\n '" . strftime("%H:%M:%S", CMbArray::variance($preparation[$_prat->user_id])) . "');";
$ds->exec($sql);
$ds->error();
}
}
echo "Liste des temps de Préparation mise à jour";
示例2: testAverage
public function testAverage()
{
$this->assertEquals(10, $this->stub->average(array(5, 10, 15)));
}