3v4l.org

run code in 300+ PHP versions simultaneously
<?php $startdate1 = "03:00"; $enddate1 = "08:00"; $startdate2 = "00:00"; $enddate2 = "06:00"; $startdate1 = date_create($startdate1); $enddate1 = date_create($enddate1); $startdate2 = date_create($startdate2); $enddate2 = date_create($enddate2); $startOverlap = max($startdate1,$startdate2); $endOverlap = min($enddate1,$enddate2); $diff = $startOverlap < $endOverlap ? $startOverlap->diff($endOverlap) : false ; echo $diff ? $diff->format('%h:%i:%s') : 'no overlap';
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 32, Position 2 = 37
Branch analysis from position: 32
1 jumps found. (Code = 42) Position 1 = 38
Branch analysis from position: 38
2 jumps found. (Code = 43) Position 1 = 40, Position 2 = 45
Branch analysis from position: 40
1 jumps found. (Code = 42) Position 1 = 46
Branch analysis from position: 46
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 45
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 37
2 jumps found. (Code = 43) Position 1 = 40, Position 2 = 45
Branch analysis from position: 40
Branch analysis from position: 45
filename:       /in/Fa1sE
function name:  (null)
number of ops:  48
compiled vars:  !0 = $startdate1, !1 = $enddate1, !2 = $startdate2, !3 = $enddate2, !4 = $startOverlap, !5 = $endOverlap, !6 = $diff
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '03%3A00'
    3     1        ASSIGN                                                   !1, '08%3A00'
    4     2        ASSIGN                                                   !2, '00%3A00'
    5     3        ASSIGN                                                   !3, '06%3A00'
    7     4        INIT_FCALL                                               'date_create'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $11     
          7        ASSIGN                                                   !0, $11
    8     8        INIT_FCALL                                               'date_create'
          9        SEND_VAR                                                 !1
         10        DO_ICALL                                         $13     
         11        ASSIGN                                                   !1, $13
    9    12        INIT_FCALL                                               'date_create'
         13        SEND_VAR                                                 !2
         14        DO_ICALL                                         $15     
         15        ASSIGN                                                   !2, $15
   10    16        INIT_FCALL                                               'date_create'
         17        SEND_VAR                                                 !3
         18        DO_ICALL                                         $17     
         19        ASSIGN                                                   !3, $17
   12    20        INIT_FCALL                                               'max'
         21        SEND_VAR                                                 !0
         22        SEND_VAR                                                 !2
         23        DO_ICALL                                         $19     
         24        ASSIGN                                                   !4, $19
   13    25        INIT_FCALL                                               'min'
         26        SEND_VAR                                                 !1
         27        SEND_VAR                                                 !3
         28        DO_ICALL                                         $21     
         29        ASSIGN                                                   !5, $21
   15    30        IS_SMALLER                                               !4, !5
         31      > JMPZ                                                     ~23, ->37
   16    32    >   INIT_METHOD_CALL                                         !4, 'diff'
         33        SEND_VAR_EX                                              !5
         34        DO_FCALL                                      0  $24     
         35        QM_ASSIGN                                        ~25     $24
         36      > JMP                                                      ->38
   17    37    >   QM_ASSIGN                                        ~25     <false>
   15    38    >   ASSIGN                                                   !6, ~25
   20    39      > JMPZ                                                     !6, ->45
         40    >   INIT_METHOD_CALL                                         !6, 'format'
         41        SEND_VAL_EX                                              '%25h%3A%25i%3A%25s'
         42        DO_FCALL                                      0  $27     
         43        QM_ASSIGN                                        ~28     $27
         44      > JMP                                                      ->46
         45    >   QM_ASSIGN                                        ~28     'no+overlap'
         46    >   ECHO                                                     ~28
         47      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.03 ms | 1017 KiB | 16 Q