home/includes/functions.php
/*
     * Function to sum an array of times into a total
	 *
	 * @param 			$times 		The array of Hours
     * @return 			string		The Total (format: 00:00:00)
     */
Function to sum an array of times into a total
@param                       $times          The array of Hours
@return                  string          The Total (format: 00:00:00)
Function to sum an array of times into a total @param $times The array of Hours @return string The Total ( format : 00 : 00 : 00 )
function sumHours($times) {
		$seconds = 0;
		foreach ($times as $time) {
			list($hour,$minute,$second) = explode(':', $time);
			$seconds += $hour*3600;
			$seconds += $minute*60;
			$seconds += $second;
		}
		$hours = floor($seconds/3600);
		$seconds -= $hours*3600;
		$minutes = floor($seconds/60);
		$seconds -= $minutes*60;
		return sprintf('%02d:%02d:%02d', $hours, $minutes, $seconds);
	}
function sumHours ( $ times ) { $ seconds = 0 ; foreach ( $ times as $ time ) { list ( $ hour , $ minute , $ second ) = explode ( ':' , $ time ) ; $ seconds += $ hour * 3600 ; $ seconds += $ minute * 60 ; $ seconds += $ second ; } $ hours = floor ( $ seconds / 3600 ) ; $ seconds -= $ hours * 3600 ; $ minutes = floor ( $ seconds / 60 ) ; $ seconds -= $ minutes * 60 ; return sprintf ( '%02d:%02d:%02d' , $ hours , $ minutes , $ seconds ) ; }
Function to sum an array of times into a total
 @param                       $times          The array of Hours
 @return                  string          The Total (format: 00:00:00)
Function to sum an array of times into a total @param $times The array of Hours @return string The Total ( format : 00 : 00 : 00 )