3v4l.org

run code in 300+ PHP versions simultaneously
<?php function timeBetweenTwoTimes($t1, $t2){ $t1 = new DateTime($t1); $t2 = new DateTime($t2); $sinceThen = $t2->diff($t1); $h = $sinceThen->h; $m = $sinceThen->i; $s = $sinceThen->s; if($h < 10){ $h = "0".$h; } if($m < 10){ $m = "0".$m; } if($s < 10){ $s = "0".$s; } return $h .':'.$m.':'.$s; } echo timeBetweenTwoTimes('9:00:00','12:00:00');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3033k
function name:  (null)
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   INIT_FCALL                                               'timebetweentwotimes'
          1        SEND_VAL                                                 '9%3A00%3A00'
          2        SEND_VAL                                                 '12%3A00%3A00'
          3        DO_FCALL                                      0  $0      
          4        ECHO                                                     $0
          5      > RETURN                                                   1

Function timebetweentwotimes:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 22, Position 2 = 24
Branch analysis from position: 22
2 jumps found. (Code = 43) Position 1 = 26, Position 2 = 28
Branch analysis from position: 26
2 jumps found. (Code = 43) Position 1 = 30, Position 2 = 32
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 32
Branch analysis from position: 28
Branch analysis from position: 24
filename:       /in/3033k
function name:  timeBetweenTwoTimes
number of ops:  38
compiled vars:  !0 = $t1, !1 = $t2, !2 = $sinceThen, !3 = $h, !4 = $m, !5 = $s
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    3     2        NEW                                              $6      'DateTime'
          3        SEND_VAR_EX                                              !0
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !0, $6
    4     6        NEW                                              $9      'DateTime'
          7        SEND_VAR_EX                                              !1
          8        DO_FCALL                                      0          
          9        ASSIGN                                                   !1, $9
    6    10        INIT_METHOD_CALL                                         !1, 'diff'
         11        SEND_VAR_EX                                              !0
         12        DO_FCALL                                      0  $12     
         13        ASSIGN                                                   !2, $12
    7    14        FETCH_OBJ_R                                      ~14     !2, 'h'
         15        ASSIGN                                                   !3, ~14
    8    16        FETCH_OBJ_R                                      ~16     !2, 'i'
         17        ASSIGN                                                   !4, ~16
    9    18        FETCH_OBJ_R                                      ~18     !2, 's'
         19        ASSIGN                                                   !5, ~18
   11    20        IS_SMALLER                                               !3, 10
         21      > JMPZ                                                     ~20, ->24
   12    22    >   CONCAT                                           ~21     '0', !3
         23        ASSIGN                                                   !3, ~21
   14    24    >   IS_SMALLER                                               !4, 10
         25      > JMPZ                                                     ~23, ->28
   15    26    >   CONCAT                                           ~24     '0', !4
         27        ASSIGN                                                   !4, ~24
   17    28    >   IS_SMALLER                                               !5, 10
         29      > JMPZ                                                     ~26, ->32
   18    30    >   CONCAT                                           ~27     '0', !5
         31        ASSIGN                                                   !5, ~27
   21    32    >   CONCAT                                           ~29     !3, '%3A'
         33        CONCAT                                           ~30     ~29, !4
         34        CONCAT                                           ~31     ~30, '%3A'
         35        CONCAT                                           ~32     ~31, !5
         36      > RETURN                                                   ~32
   22    37*     > RETURN                                                   null

End of function timebetweentwotimes

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
198.21 ms | 1403 KiB | 14 Q