Trigub_Ilia

Среднее время

Dec 19th, 2019
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.41 KB | None | 0 0
  1. $time = array (
  2.             '2452:43:44',
  3.             '452:43:44',
  4.             '242:43:44',
  5.             '252:43:44',
  6.             '2:43:44'
  7.         );
  8.  
  9. $seconds = 0;
  10. foreach($time as $hours) {
  11.     $exp = explode(':', strval($hours));
  12.     $seconds += $exp[0]*60*60 + $exp[1]*60 + $exp[2];
  13. }
  14.  
  15. $average = $seconds/sizeof( $time );
  16. echo floor($average/3600).':'.floor(($average%3600)/60).':'.($average%3600)%60;
Add Comment
Please, Sign In to add comment