3v4l.org

run code in 300+ PHP versions simultaneously
<?php $value = 'Y-100;Y-10'; $arrvalidrules = explode(';', $value); // On vérifie qu'il n'y bien que deux valeurs. if (count($arrvalidrules) == 2) { $intyearend = null; if ($arrvalidrules[0]!='') { if (is_numeric($arrvalidrules[0])) { $intyearstart=intval($arrvalidrules[0]); } else if (strpos($arrvalidrules[0], 'Y') === 0) { $intyearstart = date('Y'); if (($intsignpos = strpos($arrvalidrules[0], '+')) !== false) { $intyearstart += intval(trim(substr($arrvalidrules[0], $intsignpos+1))); } else if (($intsignpos = strpos($arrvalidrules[0], '-')) !== false) { $intyearstart -= intval(trim(substr($arrvalidrules[0], $intsignpos+1))); } } else { $intyearstart = false; } } else { $intyearstart = 0; } if ($arrvalidrules[1]!='') { if (is_numeric($arrvalidrules[1])) { $intyearend=intval($arrvalidrules[1]); } else if (strpos($arrvalidrules[1], 'Y') === 0) { $intyearend = date('Y'); if (($intsignpos = strpos($arrvalidrules[1], '+')) !== false) { $intyearend += intval(trim(substr($arrvalidrules[1], $intsignpos+1))); } else if (($intsignpos = strpos($arrvalidrules[1], '-')) !== false) { $intyearend -= intval(trim(substr($arrvalidrules[1], $intsignpos+1))); } } else { $intyearend = false; } } else { $intyearend = 0; } } $label = 'intyear'; ${$intyear} = 'test'; echo $intyear; echo 'Date : '.$intyearstart.' - '.$intyearend;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 142
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 75
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 22
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 74
Branch analysis from position: 74
1 jumps found. (Code = 42) Position 1 = 76
Branch analysis from position: 76
2 jumps found. (Code = 43) Position 1 = 79, Position 2 = 141
Branch analysis from position: 79
2 jumps found. (Code = 43) Position 1 = 84, Position 2 = 88
Branch analysis from position: 84
1 jumps found. (Code = 42) Position 1 = 140
Branch analysis from position: 140
1 jumps found. (Code = 42) Position 1 = 142
Branch analysis from position: 142
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 88
2 jumps found. (Code = 43) Position 1 = 95, Position 2 = 139
Branch analysis from position: 95
2 jumps found. (Code = 43) Position 1 = 107, Position 2 = 119
Branch analysis from position: 107
1 jumps found. (Code = 42) Position 1 = 138
Branch analysis from position: 138
1 jumps found. (Code = 42) Position 1 = 140
Branch analysis from position: 140
Branch analysis from position: 119
2 jumps found. (Code = 43) Position 1 = 127, Position 2 = 138
Branch analysis from position: 127
1 jumps found. (Code = 42) Position 1 = 140
Branch analysis from position: 140
Branch analysis from position: 138
Branch analysis from position: 139
1 jumps found. (Code = 42) Position 1 = 142
Branch analysis from position: 142
Branch analysis from position: 141
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
2 jumps found. (Code = 43) Position 1 = 29, Position 2 = 73
Branch analysis from position: 29
2 jumps found. (Code = 43) Position 1 = 41, Position 2 = 53
Branch analysis from position: 41
1 jumps found. (Code = 42) Position 1 = 72
Branch analysis from position: 72
1 jumps found. (Code = 42) Position 1 = 74
Branch analysis from position: 74
Branch analysis from position: 53
2 jumps found. (Code = 43) Position 1 = 61, Position 2 = 72
Branch analysis from position: 61
1 jumps found. (Code = 42) Position 1 = 74
Branch analysis from position: 74
Branch analysis from position: 72
Branch analysis from position: 73
1 jumps found. (Code = 42) Position 1 = 76
Branch analysis from position: 76
Branch analysis from position: 75
2 jumps found. (Code = 43) Position 1 = 79, Position 2 = 141
Branch analysis from position: 79
Branch analysis from position: 141
Branch analysis from position: 142
filename:       /in/Wiuja
function name:  (null)
number of ops:  151
compiled vars:  !0 = $value, !1 = $arrvalidrules, !2 = $intyearend, !3 = $intyearstart, !4 = $intsignpos, !5 = $label, !6 = $intyear
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'Y-100%3BY-10'
    5     1        INIT_FCALL                                               'explode'
          2        SEND_VAL                                                 '%3B'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $8      
          5        ASSIGN                                                   !1, $8
    8     6        COUNT                                            ~10     !1
          7        IS_EQUAL                                                 ~10, 2
          8      > JMPZ                                                     ~11, ->142
    9     9    >   ASSIGN                                                   !2, null
   11    10        FETCH_DIM_R                                      ~13     !1, 0
         11        IS_NOT_EQUAL                                             ~13, ''
         12      > JMPZ                                                     ~14, ->75
   12    13    >   INIT_FCALL                                               'is_numeric'
         14        FETCH_DIM_R                                      ~15     !1, 0
         15        SEND_VAL                                                 ~15
         16        DO_ICALL                                         $16     
         17      > JMPZ                                                     $16, ->22
   13    18    >   FETCH_DIM_R                                      ~17     !1, 0
         19        CAST                                          4  ~18     ~17
         20        ASSIGN                                                   !3, ~18
         21      > JMP                                                      ->74
   15    22    >   INIT_FCALL                                               'strpos'
         23        FETCH_DIM_R                                      ~20     !1, 0
         24        SEND_VAL                                                 ~20
         25        SEND_VAL                                                 'Y'
         26        DO_ICALL                                         $21     
         27        IS_IDENTICAL                                             $21, 0
         28      > JMPZ                                                     ~22, ->73
   16    29    >   INIT_FCALL                                               'date'
         30        SEND_VAL                                                 'Y'
         31        DO_ICALL                                         $23     
         32        ASSIGN                                                   !3, $23
   18    33        INIT_FCALL                                               'strpos'
         34        FETCH_DIM_R                                      ~25     !1, 0
         35        SEND_VAL                                                 ~25
         36        SEND_VAL                                                 '%2B'
         37        DO_ICALL                                         $26     
         38        ASSIGN                                           ~27     !4, $26
         39        TYPE_CHECK                                  1018          ~27
         40      > JMPZ                                                     ~28, ->53
   19    41    >   INIT_FCALL                                               'trim'
         42        INIT_FCALL                                               'substr'
         43        FETCH_DIM_R                                      ~29     !1, 0
         44        SEND_VAL                                                 ~29
         45        ADD                                              ~30     !4, 1
         46        SEND_VAL                                                 ~30
         47        DO_ICALL                                         $31     
         48        SEND_VAR                                                 $31
         49        DO_ICALL                                         $32     
         50        CAST                                          4  ~33     $32
         51        ASSIGN_OP                                     1          !3, ~33
         52      > JMP                                                      ->72
   21    53    >   INIT_FCALL                                               'strpos'
         54        FETCH_DIM_R                                      ~35     !1, 0
         55        SEND_VAL                                                 ~35
         56        SEND_VAL                                                 '-'
         57        DO_ICALL                                         $36     
         58        ASSIGN                                           ~37     !4, $36
         59        TYPE_CHECK                                  1018          ~37
         60      > JMPZ                                                     ~38, ->72
   22    61    >   INIT_FCALL                                               'trim'
         62        INIT_FCALL                                               'substr'
         63        FETCH_DIM_R                                      ~39     !1, 0
         64        SEND_VAL                                                 ~39
         65        ADD                                              ~40     !4, 1
         66        SEND_VAL                                                 ~40
         67        DO_ICALL                                         $41     
         68        SEND_VAR                                                 $41
         69        DO_ICALL                                         $42     
         70        CAST                                          4  ~43     $42
         71        ASSIGN_OP                                     2          !3, ~43
         72    > > JMP                                                      ->74
   26    73    >   ASSIGN                                                   !3, <false>
         74    > > JMP                                                      ->76
   30    75    >   ASSIGN                                                   !3, 0
   33    76    >   FETCH_DIM_R                                      ~47     !1, 1
         77        IS_NOT_EQUAL                                             ~47, ''
         78      > JMPZ                                                     ~48, ->141
   34    79    >   INIT_FCALL                                               'is_numeric'
         80        FETCH_DIM_R                                      ~49     !1, 1
         81        SEND_VAL                                                 ~49
         82        DO_ICALL                                         $50     
         83      > JMPZ                                                     $50, ->88
   35    84    >   FETCH_DIM_R                                      ~51     !1, 1
         85        CAST                                          4  ~52     ~51
         86        ASSIGN                                                   !2, ~52
         87      > JMP                                                      ->140
   37    88    >   INIT_FCALL                                               'strpos'
         89        FETCH_DIM_R                                      ~54     !1, 1
         90        SEND_VAL                                                 ~54
         91        SEND_VAL                                                 'Y'
         92        DO_ICALL                                         $55     
         93        IS_IDENTICAL                                             $55, 0
         94      > JMPZ                                                     ~56, ->139
   38    95    >   INIT_FCALL                                               'date'
         96        SEND_VAL                                                 'Y'
         97        DO_ICALL                                         $57     
         98        ASSIGN                                                   !2, $57
   40    99        INIT_FCALL                                               'strpos'
        100        FETCH_DIM_R                                      ~59     !1, 1
        101        SEND_VAL                                                 ~59
        102        SEND_VAL                                                 '%2B'
        103        DO_ICALL                                         $60     
        104        ASSIGN                                           ~61     !4, $60
        105        TYPE_CHECK                                  1018          ~61
        106      > JMPZ                                                     ~62, ->119
   41   107    >   INIT_FCALL                                               'trim'
        108        INIT_FCALL                                               'substr'
        109        FETCH_DIM_R                                      ~63     !1, 1
        110        SEND_VAL                                                 ~63
        111        ADD                                              ~64     !4, 1
        112        SEND_VAL                                                 ~64
        113        DO_ICALL                                         $65     
        114        SEND_VAR                                                 $65
        115        DO_ICALL                                         $66     
        116        CAST                                          4  ~67     $66
        117        ASSIGN_OP                                     1          !2, ~67
        118      > JMP                                                      ->138
   43   119    >   INIT_FCALL                                               'strpos'
        120        FETCH_DIM_R                                      ~69     !1, 1
        121        SEND_VAL                                                 ~69
        122        SEND_VAL                                                 '-'
        123        DO_ICALL                                         $70     
        124        ASSIGN                                           ~71     !4, $70
        125        TYPE_CHECK                                  1018          ~71
        126      > JMPZ                                                     ~72, ->138
   44   127    >   INIT_FCALL                                               'trim'
        128        INIT_FCALL                                               'substr'
        129        FETCH_DIM_R                                      ~73     !1, 1
        130        SEND_VAL                                                 ~73
        131        ADD                                              ~74     !4, 1
        132        SEND_VAL                                                 ~74
        133        DO_ICALL                                         $75     
        134        SEND_VAR                                                 $75
        135        DO_ICALL                                         $76     
        136        CAST                                          4  ~77     $76
        137        ASSIGN_OP                                     2          !2, ~77
        138    > > JMP                                                      ->140
   48   139    >   ASSIGN                                                   !2, <false>
        140    > > JMP                                                      ->142
   52   141    >   ASSIGN                                                   !2, 0
   56   142    >   ASSIGN                                                   !5, 'intyear'
   57   143        FETCH_W                      local               $82     !6
        144        ASSIGN                                                   $82, 'test'
   59   145        ECHO                                                     !6
   61   146        CONCAT                                           ~84     'Date+%3A+', !3
        147        CONCAT                                           ~85     ~84, '+-+'
        148        CONCAT                                           ~86     ~85, !2
        149        ECHO                                                     ~86
        150      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.93 ms | 1408 KiB | 25 Q