3v4l.org

run code in 500+ PHP versions simultaneously
<?php $relationships=array( array(70), array(70, 71), array(70, 71, 72), array(70, 71, 72), array(70, 71), array(80), array(70, 71), array(70, 71, 72), array(70, 71, 72), array(70, 71, 72), array(70, 71), array(70, 71, 72), array(70, 71, 72, 68) ); $old_count = 0; $index = 0; foreach($relationships as $val){ $tmp = array(); $value = array(); $count = count($val); if($count == 1){ $old_count = 0; $level = array(); $index++; $level[] = $index; } if($old_count == $count) $level[($count-1)] = ($level[($count-1)] == "" || $level[($count-1)] == null) ? 1 : ++$level[($count-1)]; else if($old_count > $count){ $level[($count-1)] = ($level[($count-1)] == "" || $level[($count-1)] == null) ? 1 : ++$level[($count-1)]; for($j = $count; $j <= $old_count; $j++) $level[$j] = 1; }else $level[$count] = 1; for($i = 0; $i < $count; $i++){ $tmp[] = $level[$i]; } $old_count = $count; echo "Indexes: ".implode(".", $tmp)."\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 81
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 81
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 16
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 37
Branch analysis from position: 18
2 jumps found. (Code = 47) Position 1 = 23, Position 2 = 27
Branch analysis from position: 23
2 jumps found. (Code = 43) Position 1 = 28, Position 2 = 30
Branch analysis from position: 28
1 jumps found. (Code = 42) Position 1 = 34
Branch analysis from position: 34
1 jumps found. (Code = 42) Position 1 = 67
Branch analysis from position: 67
1 jumps found. (Code = 42) Position 1 = 73
Branch analysis from position: 73
2 jumps found. (Code = 44) Position 1 = 75, Position 2 = 69
Branch analysis from position: 75
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 69
2 jumps found. (Code = 44) Position 1 = 75, Position 2 = 69
Branch analysis from position: 75
Branch analysis from position: 69
Branch analysis from position: 30
1 jumps found. (Code = 42) Position 1 = 67
Branch analysis from position: 67
Branch analysis from position: 27
Branch analysis from position: 37
2 jumps found. (Code = 43) Position 1 = 39, Position 2 = 65
Branch analysis from position: 39
2 jumps found. (Code = 47) Position 1 = 44, Position 2 = 48
Branch analysis from position: 44
2 jumps found. (Code = 43) Position 1 = 49, Position 2 = 51
Branch analysis from position: 49
1 jumps found. (Code = 42) Position 1 = 55
Branch analysis from position: 55
1 jumps found. (Code = 42) Position 1 = 62
Branch analysis from position: 62
2 jumps found. (Code = 44) Position 1 = 64, Position 2 = 59
Branch analysis from position: 64
1 jumps found. (Code = 42) Position 1 = 67
Branch analysis from position: 67
Branch analysis from position: 59
2 jumps found. (Code = 44) Position 1 = 64, Position 2 = 59
Branch analysis from position: 64
Branch analysis from position: 59
Branch analysis from position: 51
1 jumps found. (Code = 42) Position 1 = 62
Branch analysis from position: 62
Branch analysis from position: 48
Branch analysis from position: 65
1 jumps found. (Code = 42) Position 1 = 73
Branch analysis from position: 73
Branch analysis from position: 16
Branch analysis from position: 81
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 81
filename:       /in/i17B1
function name:  (null)
number of ops:  83
compiled vars:  !0 = $relationships, !1 = $old_count, !2 = $index, !3 = $val, !4 = $tmp, !5 = $value, !6 = $count, !7 = $level, !8 = $j, !9 = $i
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                       !0, <array>
   18     1        ASSIGN                                                       !1, 0
   19     2        ASSIGN                                                       !2, 0
   20     3      > FE_RESET_R                                           $13     !0, ->81
          4    > > FE_FETCH_R                                                   $13, !3, ->81
   21     5    >   ASSIGN                                                       !4, <array>
   22     6        ASSIGN                                                       !5, <array>
   23     7        COUNT                                                ~16     !3
          8        ASSIGN                                                       !6, ~16
   24     9        IS_EQUAL                                                     !6, 1
         10      > JMPZ                                                         ~18, ->16
   25    11    >   ASSIGN                                                       !1, 0
   26    12        ASSIGN                                                       !7, <array>
   27    13        PRE_INC                                                      !2
   28    14        ASSIGN_DIM                                                   !7
         15        OP_DATA                                                      !2
   31    16    >   IS_EQUAL                                                     !1, !6
         17      > JMPZ                                                         ~23, ->37
   32    18    >   SUB                                                  ~24     !6, 1
         19        SUB                                                  ~26     !6, 1
         20        FETCH_DIM_R                                          ~27     !7, ~26
         21        IS_EQUAL                                             ~28     ~27, ''
         22      > JMPNZ_EX                                             ~28     ~28, ->27
         23    >   SUB                                                  ~29     !6, 1
         24        FETCH_DIM_R                                          ~30     !7, ~29
         25        IS_EQUAL                                             ~31     ~30, null
         26        BOOL                                                 ~28     ~31
         27    > > JMPZ                                                         ~28, ->30
         28    >   QM_ASSIGN                                            ~32     1
         29      > JMP                                                          ->34
         30    >   SUB                                                  ~33     !6, 1
         31        FETCH_DIM_RW                                         $34     !7, ~33
         32        PRE_INC                                              ~35     $34
         33        QM_ASSIGN                                            ~32     ~35
         34    >   ASSIGN_DIM                                                   !7, ~24
         35        OP_DATA                                                      ~32
   31    36      > JMP                                                          ->67
   33    37    >   IS_SMALLER                                                   !6, !1
         38      > JMPZ                                                         ~36, ->65
   34    39    >   SUB                                                  ~37     !6, 1
         40        SUB                                                  ~39     !6, 1
         41        FETCH_DIM_R                                          ~40     !7, ~39
         42        IS_EQUAL                                             ~41     ~40, ''
         43      > JMPNZ_EX                                             ~41     ~41, ->48
         44    >   SUB                                                  ~42     !6, 1
         45        FETCH_DIM_R                                          ~43     !7, ~42
         46        IS_EQUAL                                             ~44     ~43, null
         47        BOOL                                                 ~41     ~44
         48    > > JMPZ                                                         ~41, ->51
         49    >   QM_ASSIGN                                            ~45     1
         50      > JMP                                                          ->55
         51    >   SUB                                                  ~46     !6, 1
         52        FETCH_DIM_RW                                         $47     !7, ~46
         53        PRE_INC                                              ~48     $47
         54        QM_ASSIGN                                            ~45     ~48
         55    >   ASSIGN_DIM                                                   !7, ~37
         56        OP_DATA                                                      ~45
   35    57        ASSIGN                                                       !8, !6
         58      > JMP                                                          ->62
   36    59    >   ASSIGN_DIM                                                   !7, !8
         60        OP_DATA                                                      1
   35    61        PRE_INC                                                      !8
         62    >   IS_SMALLER_OR_EQUAL                                          !8, !1
         63      > JMPNZ                                                        ~52, ->59
   33    64    > > JMP                                                          ->67
   38    65    >   ASSIGN_DIM                                                   !7, !6
         66        OP_DATA                                                      1
   40    67    >   ASSIGN                                                       !9, 0
         68      > JMP                                                          ->73
   41    69    >   FETCH_DIM_R                                          ~56     !7, !9
         70        ASSIGN_DIM                                                   !4
         71        OP_DATA                                                      ~56
   40    72        PRE_INC                                                      !9
         73    >   IS_SMALLER                                                   !9, !6
         74      > JMPNZ                                                        ~58, ->69
   43    75    >   ASSIGN                                                       !1, !6
   44    76        FRAMELESS_ICALL_2                implode             ~60     '.', !4
         77        CONCAT                                               ~61     'Indexes%3A+', ~60
         78        CONCAT                                               ~62     ~61, '%0A'
         79        ECHO                                                         ~62
   20    80      > JMP                                                          ->4
         81    >   FE_FREE                                                      $13
   45    82      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
143.74 ms | 2280 KiB | 13 Q