3v4l.org

run code in 300+ PHP versions simultaneously
<?php function get_time_difference($time1, $time2) { $time1 = strtotime("1980-01-01 $time1"); $time2 = strtotime("1980-01-01 $time2"); if ($time2 < $time1) { $time2 += 86400; } return date("H:i", strtotime("1980-01-01 00:00") + ($time2 - $time1)); } echo get_time_difference("10:25", "22:40"); // 12:15 ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/USgaZ
function name:  (null)
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   INIT_FCALL                                               'get_time_difference'
          1        SEND_VAL                                                 '10%3A25'
          2        SEND_VAL                                                 '22%3A40'
          3        DO_FCALL                                      0  $0      
          4        ECHO                                                     $0
   16     5      > RETURN                                                   1

Function get_time_difference:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 17
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
filename:       /in/USgaZ
function name:  get_time_difference
number of ops:  28
compiled vars:  !0 = $time1, !1 = $time2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    4     2        INIT_FCALL                                               'strtotime'
          3        NOP                                                      
          4        FAST_CONCAT                                      ~2      '1980-01-01+', !0
          5        SEND_VAL                                                 ~2
          6        DO_ICALL                                         $3      
          7        ASSIGN                                                   !0, $3
    5     8        INIT_FCALL                                               'strtotime'
          9        NOP                                                      
         10        FAST_CONCAT                                      ~5      '1980-01-01+', !1
         11        SEND_VAL                                                 ~5
         12        DO_ICALL                                         $6      
         13        ASSIGN                                                   !1, $6
    7    14        IS_SMALLER                                               !1, !0
         15      > JMPZ                                                     ~8, ->17
    8    16    >   ASSIGN_OP                                     1          !1, 86400
   11    17    >   INIT_FCALL                                               'date'
         18        SEND_VAL                                                 'H%3Ai'
         19        INIT_FCALL                                               'strtotime'
         20        SEND_VAL                                                 '1980-01-01+00%3A00'
         21        DO_ICALL                                         $10     
         22        SUB                                              ~11     !1, !0
         23        ADD                                              ~12     $10, ~11
         24        SEND_VAL                                                 ~12
         25        DO_ICALL                                         $13     
         26      > RETURN                                                   $13
   12    27*     > RETURN                                                   null

End of function get_time_difference

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
194.26 ms | 1399 KiB | 18 Q