array_sumをcountで割った数をh:m:sに変換します。
$avgtime = array_sum($avgtime) / count($avgtime); $time = s2h($avgtime); function s2h($avgtime){ $hours = floor($avgtime / 3600); $minutes = floor(($avgtime / 60)%60); $seconds = $avgtime % 60; $hms = sprintf("%02d:%02d:%02d", $hours, $minutes, $seconds); return $hms; }
次は、new user とreturn user