3v4l.org

run code in 300+ PHP versions simultaneously
<?php function calcDays($startdate, $enddate) { $first = $startdate < $enddate ? $startdate : $enddate; $second = $startdate < $enddate ? $enddate : $startdate; $inbetween = $second - $first; $i[0] = 60; $i[1] = 24; $i[2] = 7; $i[3] = date('t', strtotime('-1 month', $second)); $i[4] = date('L', strtotime('-1 year', $second)) ? 366 : 365; $month = floor($inbetween / $i[0] / $i[0] / $i[1] / $i[3] % $i[4]); $days = floor($inbetween / $i[0] / $i[0] / $i[1] % $i[3]); $hours = floor($inbetween / $i[0] / $i[0] % $i[1]); $minutes = floor($inbetween / $i[0] % $i[0]); $seconds = $inbetween % $i[0]; return $days . " " . $hours . " " . $minutes . " " . $seconds . " " . $inbetween; } echo calcDays(1388389166, 1419925156);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/bADF0
function name:  (null)
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   INIT_FCALL                                               'calcdays'
          1        SEND_VAL                                                 1388389166
          2        SEND_VAL                                                 1419925156
          3        DO_FCALL                                      0  $0      
          4        ECHO                                                     $0
          5      > RETURN                                                   1

Function calcdays:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 6
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 12
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 41, Position 2 = 43
Branch analysis from position: 41
1 jumps found. (Code = 42) Position 1 = 44
Branch analysis from position: 44
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 43
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 41, Position 2 = 43
Branch analysis from position: 41
Branch analysis from position: 43
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 12
Branch analysis from position: 10
Branch analysis from position: 12
filename:       /in/bADF0
function name:  calcDays
number of ops:  103
compiled vars:  !0 = $startdate, !1 = $enddate, !2 = $first, !3 = $second, !4 = $inbetween, !5 = $i, !6 = $month, !7 = $days, !8 = $hours, !9 = $minutes, !10 = $seconds
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    4     2        IS_SMALLER                                               !0, !1
          3      > JMPZ                                                     ~11, ->6
          4    >   QM_ASSIGN                                        ~12     !0
          5      > JMP                                                      ->7
          6    >   QM_ASSIGN                                        ~12     !1
          7    >   ASSIGN                                                   !2, ~12
    5     8        IS_SMALLER                                               !0, !1
          9      > JMPZ                                                     ~14, ->12
         10    >   QM_ASSIGN                                        ~15     !1
         11      > JMP                                                      ->13
         12    >   QM_ASSIGN                                        ~15     !0
         13    >   ASSIGN                                                   !3, ~15
    6    14        SUB                                              ~17     !3, !2
         15        ASSIGN                                                   !4, ~17
    8    16        ASSIGN_DIM                                               !5, 0
         17        OP_DATA                                                  60
    9    18        ASSIGN_DIM                                               !5, 1
         19        OP_DATA                                                  24
   10    20        ASSIGN_DIM                                               !5, 2
         21        OP_DATA                                                  7
   11    22        INIT_FCALL                                               'date'
         23        SEND_VAL                                                 't'
         24        INIT_FCALL                                               'strtotime'
         25        SEND_VAL                                                 '-1+month'
         26        SEND_VAR                                                 !3
         27        DO_ICALL                                         $23     
         28        SEND_VAR                                                 $23
         29        DO_ICALL                                         $24     
         30        ASSIGN_DIM                                               !5, 3
         31        OP_DATA                                                  $24
   12    32        INIT_FCALL                                               'date'
         33        SEND_VAL                                                 'L'
         34        INIT_FCALL                                               'strtotime'
         35        SEND_VAL                                                 '-1+year'
         36        SEND_VAR                                                 !3
         37        DO_ICALL                                         $26     
         38        SEND_VAR                                                 $26
         39        DO_ICALL                                         $27     
         40      > JMPZ                                                     $27, ->43
         41    >   QM_ASSIGN                                        ~28     366
         42      > JMP                                                      ->44
         43    >   QM_ASSIGN                                        ~28     365
         44    >   ASSIGN_DIM                                               !5, 4
         45        OP_DATA                                                  ~28
   15    46        INIT_FCALL                                               'floor'
         47        FETCH_DIM_R                                      ~29     !5, 0
         48        DIV                                              ~30     !4, ~29
         49        FETCH_DIM_R                                      ~31     !5, 0
         50        DIV                                              ~32     ~30, ~31
         51        FETCH_DIM_R                                      ~33     !5, 1
         52        DIV                                              ~34     ~32, ~33
         53        FETCH_DIM_R                                      ~35     !5, 3
         54        DIV                                              ~36     ~34, ~35
         55        FETCH_DIM_R                                      ~37     !5, 4
         56        MOD                                              ~38     ~36, ~37
         57        SEND_VAL                                                 ~38
         58        DO_ICALL                                         $39     
         59        ASSIGN                                                   !6, $39
   16    60        INIT_FCALL                                               'floor'
         61        FETCH_DIM_R                                      ~41     !5, 0
         62        DIV                                              ~42     !4, ~41
         63        FETCH_DIM_R                                      ~43     !5, 0
         64        DIV                                              ~44     ~42, ~43
         65        FETCH_DIM_R                                      ~45     !5, 1
         66        DIV                                              ~46     ~44, ~45
         67        FETCH_DIM_R                                      ~47     !5, 3
         68        MOD                                              ~48     ~46, ~47
         69        SEND_VAL                                                 ~48
         70        DO_ICALL                                         $49     
         71        ASSIGN                                                   !7, $49
   17    72        INIT_FCALL                                               'floor'
         73        FETCH_DIM_R                                      ~51     !5, 0
         74        DIV                                              ~52     !4, ~51
         75        FETCH_DIM_R                                      ~53     !5, 0
         76        DIV                                              ~54     ~52, ~53
         77        FETCH_DIM_R                                      ~55     !5, 1
         78        MOD                                              ~56     ~54, ~55
         79        SEND_VAL                                                 ~56
         80        DO_ICALL                                         $57     
         81        ASSIGN                                                   !8, $57
   18    82        INIT_FCALL                                               'floor'
         83        FETCH_DIM_R                                      ~59     !5, 0
         84        DIV                                              ~60     !4, ~59
         85        FETCH_DIM_R                                      ~61     !5, 0
         86        MOD                                              ~62     ~60, ~61
         87        SEND_VAL                                                 ~62
         88        DO_ICALL                                         $63     
         89        ASSIGN                                                   !9, $63
   19    90        FETCH_DIM_R                                      ~65     !5, 0
         91        MOD                                              ~66     !4, ~65
         92        ASSIGN                                                   !10, ~66
   21    93        CONCAT                                           ~68     !7, '+'
         94        CONCAT                                           ~69     ~68, !8
         95        CONCAT                                           ~70     ~69, '+'
         96        CONCAT                                           ~71     ~70, !9
         97        CONCAT                                           ~72     ~71, '+'
         98        CONCAT                                           ~73     ~72, !10
         99        CONCAT                                           ~74     ~73, '+'
        100        CONCAT                                           ~75     ~74, !4
        101      > RETURN                                                   ~75
   22   102*     > RETURN                                                   null

End of function calcdays

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.99 ms | 952 KiB | 21 Q