3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input = array('00:10', '00:24', '00:02', '00:00', '00:09', '01:11', '00:22'); $hours = $minutes = 0; foreach ($input as $value) { list($hour, $minute) = explode(':', $value); $hours += $hour; $minutes += $minute; } // Add Hours $hours += floor($minutes / 60); $minutes = $minutes % 60; echo sprintf("Total %02d:%02d", $hours, $minutes);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 17
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 17
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
filename:       /in/iV1pN
function name:  (null)
number of ops:  32
compiled vars:  !0 = $input, !1 = $hours, !2 = $minutes, !3 = $value, !4 = $hour, !5 = $minute
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    5     1        ASSIGN                                           ~7      !2, 0
          2        ASSIGN                                                   !1, ~7
    6     3      > FE_RESET_R                                       $9      !0, ->17
          4    > > FE_FETCH_R                                               $9, !3, ->17
    7     5    >   INIT_FCALL                                               'explode'
          6        SEND_VAL                                                 '%3A'
          7        SEND_VAR                                                 !3
          8        DO_ICALL                                         $10     
          9        FETCH_LIST_R                                     $11     $10, 0
         10        ASSIGN                                                   !4, $11
         11        FETCH_LIST_R                                     $13     $10, 1
         12        ASSIGN                                                   !5, $13
         13        FREE                                                     $10
    8    14        ASSIGN_OP                                     1          !1, !4
    9    15        ASSIGN_OP                                     1          !2, !5
    6    16      > JMP                                                      ->4
         17    >   FE_FREE                                                  $9
   13    18        INIT_FCALL                                               'floor'
         19        DIV                                              ~17     !2, 60
         20        SEND_VAL                                                 ~17
         21        DO_ICALL                                         $18     
         22        ASSIGN_OP                                     1          !1, $18
   14    23        MOD                                              ~20     !2, 60
         24        ASSIGN                                                   !2, ~20
   16    25        INIT_FCALL                                               'sprintf'
         26        SEND_VAL                                                 'Total+%2502d%3A%2502d'
         27        SEND_VAR                                                 !1
         28        SEND_VAR                                                 !2
         29        DO_ICALL                                         $22     
         30        ECHO                                                     $22
         31      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.43 ms | 1013 KiB | 16 Q