3v4l.org

run code in 300+ PHP versions simultaneously
<?php function sumTimes($time1, $time2) { list($hours1, $minutes1) = explode(':', $time1); list($hours2, $minutes2) = explode(':', $time2); $totalHours = $hours1 + $hours2; $totalMinutes = $minutes1 + $minutes2; if($totalMinutes >= 60){ $hoursInMins = floor($totalMinutes/60); $totalHours += $hoursInMins; $totalMinutes -= ($hoursInMins * 60); } return "$totalHours:$totalMinutes"; } echo sumTimes('12:54', '100:06') . PHP_EOL; echo sumTimes('12:54', '100:20') . PHP_EOL;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9Ko6v
function name:  (null)
number of ops:  13
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   INIT_FCALL                                               'sumtimes'
          1        SEND_VAL                                                 '12%3A54'
          2        SEND_VAL                                                 '100%3A06'
          3        DO_FCALL                                      0  $0      
          4        CONCAT                                           ~1      $0, '%0A'
          5        ECHO                                                     ~1
   17     6        INIT_FCALL                                               'sumtimes'
          7        SEND_VAL                                                 '12%3A54'
          8        SEND_VAL                                                 '100%3A20'
          9        DO_FCALL                                      0  $2      
         10        CONCAT                                           ~3      $2, '%0A'
         11        ECHO                                                     ~3
         12      > RETURN                                                   1

Function sumtimes:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 26, Position 2 = 34
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 34
filename:       /in/9Ko6v
function name:  sumTimes
number of ops:  39
compiled vars:  !0 = $time1, !1 = $time2, !2 = $hours1, !3 = $minutes1, !4 = $hours2, !5 = $minutes2, !6 = $totalHours, !7 = $totalMinutes, !8 = $hoursInMins
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    4     2        INIT_FCALL                                               'explode'
          3        SEND_VAL                                                 '%3A'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $9      
          6        FETCH_LIST_R                                     $10     $9, 0
          7        ASSIGN                                                   !2, $10
          8        FETCH_LIST_R                                     $12     $9, 1
          9        ASSIGN                                                   !3, $12
         10        FREE                                                     $9
    5    11        INIT_FCALL                                               'explode'
         12        SEND_VAL                                                 '%3A'
         13        SEND_VAR                                                 !1
         14        DO_ICALL                                         $14     
         15        FETCH_LIST_R                                     $15     $14, 0
         16        ASSIGN                                                   !4, $15
         17        FETCH_LIST_R                                     $17     $14, 1
         18        ASSIGN                                                   !5, $17
         19        FREE                                                     $14
    6    20        ADD                                              ~19     !2, !4
         21        ASSIGN                                                   !6, ~19
    7    22        ADD                                              ~21     !3, !5
         23        ASSIGN                                                   !7, ~21
    8    24        IS_SMALLER_OR_EQUAL                                      60, !7
         25      > JMPZ                                                     ~23, ->34
    9    26    >   INIT_FCALL                                               'floor'
         27        DIV                                              ~24     !7, 60
         28        SEND_VAL                                                 ~24
         29        DO_ICALL                                         $25     
         30        ASSIGN                                                   !8, $25
   10    31        ASSIGN_OP                                     1          !6, !8
   11    32        MUL                                              ~28     !8, 60
         33        ASSIGN_OP                                     2          !7, ~28
   13    34    >   ROPE_INIT                                     3  ~31     !6
         35        ROPE_ADD                                      1  ~31     ~31, '%3A'
         36        ROPE_END                                      2  ~30     ~31, !7
         37      > RETURN                                                   ~30
   14    38*     > RETURN                                                   null

End of function sumtimes

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.46 ms | 1403 KiB | 19 Q