3v4l.org

run code in 300+ PHP versions simultaneously
<?php function d2d ($date, $to){ $date = explode ("/", $date); $to = explode ("/", $to); if (count($date) != 3 or count($to) != 3){ return 0; } else { $dateexp = ($date[0] * 100 + $date[1]) * 100 + $date[2]; $toexp = ($to[0] * 100 + $to[1]) * 100 + $to[2]; if ($dateexp > $toexp){ return -1; } elseif ($dateexp == $toexp){ return 0; } else { $dif = 0; $moves = 0; while ($to[0] >= $date[0]){ if ($date[1] != $to[1] or $date[1] == $to[1] and $date[0] != $to[0]){ if ($moves == 0){ if ($date[1] <= 6){ $dif = 31 - $date[2]; $date[1] ++; } elseif ($date[1] > 6 and $date[1] < 12){ $dif = 30 - $date[2]; $date[1] ++; } else { $dif = 29 - $date[2]; $date[1] = 1; $date[0] ++; } } else{ if ($date[1] <= 6){ $dif = $dif + 31; $date[1] ++; } elseif ($date[1] > 6 and $date[1] < 12){ $dif = $dif + 30; $date[1] ++; } else { $dif = $dif + 29; $date[1] = 1; $date[0] ++; } } $moves ++; } else{ if ($moves == 0){ $dif = $to[2] - $date[2]; break; } else{ $dif = $dif + $to[2]; break; } } } } return $dif; } } echo d2d("1396/4/25", "1396/04/25"); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/bKgkC
function name:  (null)
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   69     0  E >   INIT_FCALL                                               'd2d'
          1        SEND_VAL                                                 '1396%2F4%2F25'
          2        SEND_VAL                                                 '1396%2F04%2F25'
          3        DO_FCALL                                      0  $0      
          4        ECHO                                                     $0
   70     5      > RETURN                                                   1

Function d2d:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 15, Position 2 = 18
Branch analysis from position: 15
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 21
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
2 jumps found. (Code = 43) Position 1 = 39, Position 2 = 41
Branch analysis from position: 39
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 41
2 jumps found. (Code = 43) Position 1 = 43, Position 2 = 45
Branch analysis from position: 43
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 45
1 jumps found. (Code = 42) Position 1 = 134
Branch analysis from position: 134
2 jumps found. (Code = 44) Position 1 = 138, Position 2 = 48
Branch analysis from position: 138
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 48
2 jumps found. (Code = 47) Position 1 = 52, Position 2 = 61
Branch analysis from position: 52
2 jumps found. (Code = 46) Position 1 = 56, Position 2 = 60
Branch analysis from position: 56
2 jumps found. (Code = 43) Position 1 = 62, Position 2 = 122
Branch analysis from position: 62
2 jumps found. (Code = 43) Position 1 = 64, Position 2 = 94
Branch analysis from position: 64
2 jumps found. (Code = 43) Position 1 = 67, Position 2 = 73
Branch analysis from position: 67
1 jumps found. (Code = 42) Position 1 = 93
Branch analysis from position: 93
1 jumps found. (Code = 42) Position 1 = 120
Branch analysis from position: 120
1 jumps found. (Code = 42) Position 1 = 134
Branch analysis from position: 134
Branch analysis from position: 73
2 jumps found. (Code = 46) Position 1 = 76, Position 2 = 79
Branch analysis from position: 76
2 jumps found. (Code = 43) Position 1 = 80, Position 2 = 86
Branch analysis from position: 80
1 jumps found. (Code = 42) Position 1 = 93
Branch analysis from position: 93
Branch analysis from position: 86
1 jumps found. (Code = 42) Position 1 = 120
Branch analysis from position: 120
Branch analysis from position: 79
Branch analysis from position: 94
2 jumps found. (Code = 43) Position 1 = 97, Position 2 = 102
Branch analysis from position: 97
1 jumps found. (Code = 42) Position 1 = 120
Branch analysis from position: 120
Branch analysis from position: 102
2 jumps found. (Code = 46) Position 1 = 105, Position 2 = 108
Branch analysis from position: 105
2 jumps found. (Code = 43) Position 1 = 109, Position 2 = 114
Branch analysis from position: 109
1 jumps found. (Code = 42) Position 1 = 120
Branch analysis from position: 120
Branch analysis from position: 114
1 jumps found. (Code = 42) Position 1 = 134
Branch analysis from position: 134
Branch analysis from position: 108
Branch analysis from position: 122
2 jumps found. (Code = 43) Position 1 = 124, Position 2 = 130
Branch analysis from position: 124
1 jumps found. (Code = 42) Position 1 = 138
Branch analysis from position: 138
Branch analysis from position: 130
1 jumps found. (Code = 42) Position 1 = 138
Branch analysis from position: 138
Branch analysis from position: 60
Branch analysis from position: 61
Branch analysis from position: 18
filename:       /in/bKgkC
function name:  d2d
number of ops:  140
compiled vars:  !0 = $date, !1 = $to, !2 = $dateexp, !3 = $toexp, !4 = $dif, !5 = $moves
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    3     2        INIT_FCALL                                               'explode'
          3        SEND_VAL                                                 '%2F'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $6      
          6        ASSIGN                                                   !0, $6
    4     7        INIT_FCALL                                               'explode'
          8        SEND_VAL                                                 '%2F'
          9        SEND_VAR                                                 !1
         10        DO_ICALL                                         $8      
         11        ASSIGN                                                   !1, $8
    5    12        COUNT                                            ~10     !0
         13        IS_NOT_EQUAL                                     ~11     ~10, 3
         14      > JMPNZ_EX                                         ~11     ~11, ->18
         15    >   COUNT                                            ~12     !1
         16        IS_NOT_EQUAL                                     ~13     ~12, 3
         17        BOOL                                             ~11     ~13
         18    > > JMPZ                                                     ~11, ->21
    6    19    > > RETURN                                                   0
         20*       JMP                                                      ->139
    9    21    >   FETCH_DIM_R                                      ~14     !0, 0
         22        MUL                                              ~15     ~14, 100
         23        FETCH_DIM_R                                      ~16     !0, 1
         24        ADD                                              ~17     ~15, ~16
         25        MUL                                              ~18     ~17, 100
         26        FETCH_DIM_R                                      ~19     !0, 2
         27        ADD                                              ~20     ~18, ~19
         28        ASSIGN                                                   !2, ~20
   10    29        FETCH_DIM_R                                      ~22     !1, 0
         30        MUL                                              ~23     ~22, 100
         31        FETCH_DIM_R                                      ~24     !1, 1
         32        ADD                                              ~25     ~23, ~24
         33        MUL                                              ~26     ~25, 100
         34        FETCH_DIM_R                                      ~27     !1, 2
         35        ADD                                              ~28     ~26, ~27
         36        ASSIGN                                                   !3, ~28
   11    37        IS_SMALLER                                               !3, !2
         38      > JMPZ                                                     ~30, ->41
   12    39    > > RETURN                                                   -1
         40*       JMP                                                      ->138
   14    41    >   IS_EQUAL                                                 !2, !3
         42      > JMPZ                                                     ~31, ->45
   15    43    > > RETURN                                                   0
         44*       JMP                                                      ->138
   18    45    >   ASSIGN                                                   !4, 0
   19    46        ASSIGN                                                   !5, 0
   20    47      > JMP                                                      ->134
   21    48    >   FETCH_DIM_R                                      ~34     !0, 1
         49        FETCH_DIM_R                                      ~35     !1, 1
         50        IS_NOT_EQUAL                                     ~36     ~34, ~35
         51      > JMPNZ_EX                                         ~36     ~36, ->61
         52    >   FETCH_DIM_R                                      ~37     !0, 1
         53        FETCH_DIM_R                                      ~38     !1, 1
         54        IS_EQUAL                                         ~39     ~37, ~38
         55      > JMPZ_EX                                          ~39     ~39, ->60
         56    >   FETCH_DIM_R                                      ~40     !0, 0
         57        FETCH_DIM_R                                      ~41     !1, 0
         58        IS_NOT_EQUAL                                     ~42     ~40, ~41
         59        BOOL                                             ~39     ~42
         60    >   BOOL                                             ~36     ~39
         61    > > JMPZ                                                     ~36, ->122
   22    62    >   IS_EQUAL                                                 !5, 0
         63      > JMPZ                                                     ~43, ->94
   23    64    >   FETCH_DIM_R                                      ~44     !0, 1
         65        IS_SMALLER_OR_EQUAL                                      ~44, 6
         66      > JMPZ                                                     ~45, ->73
   24    67    >   FETCH_DIM_R                                      ~46     !0, 2
         68        SUB                                              ~47     31, ~46
         69        ASSIGN                                                   !4, ~47
   25    70        FETCH_DIM_RW                                     $49     !0, 1
         71        PRE_INC                                                  $49
         72      > JMP                                                      ->93
   27    73    >   FETCH_DIM_R                                      ~51     !0, 1
         74        IS_SMALLER                                       ~52     6, ~51
         75      > JMPZ_EX                                          ~52     ~52, ->79
         76    >   FETCH_DIM_R                                      ~53     !0, 1
         77        IS_SMALLER                                       ~54     ~53, 12
         78        BOOL                                             ~52     ~54
         79    > > JMPZ                                                     ~52, ->86
   28    80    >   FETCH_DIM_R                                      ~55     !0, 2
         81        SUB                                              ~56     30, ~55
         82        ASSIGN                                                   !4, ~56
   29    83        FETCH_DIM_RW                                     $58     !0, 1
         84        PRE_INC                                                  $58
         85      > JMP                                                      ->93
   32    86    >   FETCH_DIM_R                                      ~60     !0, 2
         87        SUB                                              ~61     29, ~60
         88        ASSIGN                                                   !4, ~61
   33    89        ASSIGN_DIM                                               !0, 1
         90        OP_DATA                                                  1
   34    91        FETCH_DIM_RW                                     $64     !0, 0
         92        PRE_INC                                                  $64
         93    > > JMP                                                      ->120
   38    94    >   FETCH_DIM_R                                      ~66     !0, 1
         95        IS_SMALLER_OR_EQUAL                                      ~66, 6
         96      > JMPZ                                                     ~67, ->102
   39    97    >   ADD                                              ~68     !4, 31
         98        ASSIGN                                                   !4, ~68
   40    99        FETCH_DIM_RW                                     $70     !0, 1
        100        PRE_INC                                                  $70
        101      > JMP                                                      ->120
   42   102    >   FETCH_DIM_R                                      ~72     !0, 1
        103        IS_SMALLER                                       ~73     6, ~72
        104      > JMPZ_EX                                          ~73     ~73, ->108
        105    >   FETCH_DIM_R                                      ~74     !0, 1
        106        IS_SMALLER                                       ~75     ~74, 12
        107        BOOL                                             ~73     ~75
        108    > > JMPZ                                                     ~73, ->114
   43   109    >   ADD                                              ~76     !4, 30
        110        ASSIGN                                                   !4, ~76
   44   111        FETCH_DIM_RW                                     $78     !0, 1
        112        PRE_INC                                                  $78
        113      > JMP                                                      ->120
   47   114    >   ADD                                              ~80     !4, 29
        115        ASSIGN                                                   !4, ~80
   48   116        ASSIGN_DIM                                               !0, 1
        117        OP_DATA                                                  1
   49   118        FETCH_DIM_RW                                     $83     !0, 0
        119        PRE_INC                                                  $83
   52   120    >   PRE_INC                                                  !5
        121      > JMP                                                      ->134
   55   122    >   IS_EQUAL                                                 !5, 0
        123      > JMPZ                                                     ~86, ->130
   56   124    >   FETCH_DIM_R                                      ~87     !1, 2
        125        FETCH_DIM_R                                      ~88     !0, 2
        126        SUB                                              ~89     ~87, ~88
        127        ASSIGN                                                   !4, ~89
   57   128      > JMP                                                      ->138
        129*       JMP                                                      ->134
   60   130    >   FETCH_DIM_R                                      ~91     !1, 2
        131        ADD                                              ~92     !4, ~91
        132        ASSIGN                                                   !4, ~92
   61   133      > JMP                                                      ->138
   20   134    >   FETCH_DIM_R                                      ~94     !1, 0
        135        FETCH_DIM_R                                      ~95     !0, 0
        136        IS_SMALLER_OR_EQUAL                                      ~95, ~94
        137      > JMPNZ                                                    ~96, ->48
   66   138    > > RETURN                                                   !4
   68   139*     > RETURN                                                   null

End of function d2d

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
189.73 ms | 1411 KiB | 16 Q