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; $minute = 60; $hour = $minute * 60; $day = $hour * 24; $week = $day * 7; $month = 30; $days = floor($inbetween / 60 / 60 / 24 - 30); $hours = floor($inbetween / 60 / 60 / 60); $minutes = floor($inbetween / 60); $seconds = $inbetween % $minutes; return $days . " " . $hours . " " . $minutes . " " . $seconds . " " . $inbetween; } echo calcDays(1388389156, 1391067562);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/l9ciS
function name:  (null)
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   INIT_FCALL                                               'calcdays'
          1        SEND_VAL                                                 1388389156
          2        SEND_VAL                                                 1391067562
          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
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
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/l9ciS
function name:  calcDays
number of ops:  56
compiled vars:  !0 = $startdate, !1 = $enddate, !2 = $first, !3 = $second, !4 = $inbetween, !5 = $minute, !6 = $hour, !7 = $day, !8 = $week, !9 = $month, !10 = $days, !11 = $hours, !12 = $minutes, !13 = $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                                                     ~14, ->6
          4    >   QM_ASSIGN                                        ~15     !0
          5      > JMP                                                      ->7
          6    >   QM_ASSIGN                                        ~15     !1
          7    >   ASSIGN                                                   !2, ~15
    5     8        IS_SMALLER                                               !0, !1
          9      > JMPZ                                                     ~17, ->12
         10    >   QM_ASSIGN                                        ~18     !1
         11      > JMP                                                      ->13
         12    >   QM_ASSIGN                                        ~18     !0
         13    >   ASSIGN                                                   !3, ~18
    6    14        SUB                                              ~20     !3, !2
         15        ASSIGN                                                   !4, ~20
    8    16        ASSIGN                                                   !5, 60
    9    17        MUL                                              ~23     !5, 60
         18        ASSIGN                                                   !6, ~23
   10    19        MUL                                              ~25     !6, 24
         20        ASSIGN                                                   !7, ~25
   11    21        MUL                                              ~27     !7, 7
         22        ASSIGN                                                   !8, ~27
   13    23        ASSIGN                                                   !9, 30
   14    24        INIT_FCALL                                               'floor'
         25        DIV                                              ~30     !4, 60
         26        DIV                                              ~31     ~30, 60
         27        DIV                                              ~32     ~31, 24
         28        SUB                                              ~33     ~32, 30
         29        SEND_VAL                                                 ~33
         30        DO_ICALL                                         $34     
         31        ASSIGN                                                   !10, $34
   15    32        INIT_FCALL                                               'floor'
         33        DIV                                              ~36     !4, 60
         34        DIV                                              ~37     ~36, 60
         35        DIV                                              ~38     ~37, 60
         36        SEND_VAL                                                 ~38
         37        DO_ICALL                                         $39     
         38        ASSIGN                                                   !11, $39
   16    39        INIT_FCALL                                               'floor'
         40        DIV                                              ~41     !4, 60
         41        SEND_VAL                                                 ~41
         42        DO_ICALL                                         $42     
         43        ASSIGN                                                   !12, $42
   17    44        MOD                                              ~44     !4, !12
         45        ASSIGN                                                   !13, ~44
   19    46        CONCAT                                           ~46     !10, '+'
         47        CONCAT                                           ~47     ~46, !11
         48        CONCAT                                           ~48     ~47, '+'
         49        CONCAT                                           ~49     ~48, !12
         50        CONCAT                                           ~50     ~49, '+'
         51        CONCAT                                           ~51     ~50, !13
         52        CONCAT                                           ~52     ~51, '+'
         53        CONCAT                                           ~53     ~52, !4
         54      > RETURN                                                   ~53
   20    55*     > RETURN                                                   null

End of function calcdays

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.43 ms | 1394 KiB | 16 Q