3v4l.org

run code in 300+ PHP versions simultaneously
<?php function depth_picker($arr, $temp_string, &$collect) { if ($temp_string != "") $collect []= $temp_string; for ($i=0; $i<sizeof($arr);$i++) { $arrcopy = $arr; $elem = array_splice($arrcopy, $i, 1); // removes and returns the i'th element if (sizeof($arrcopy) > 0) { depth_picker($arrcopy, $temp_string ." " . $elem[0], $collect); } else { $collect []= $temp_string. " " . $elem[0]; } } } $collect = array(); depth_picker(array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'), "", $collect); print_r($collect);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iUCk4
function name:  (null)
number of ops:  10
compiled vars:  !0 = $collect
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   ASSIGN                                                   !0, <array>
   19     1        INIT_FCALL                                               'depth_picker'
          2        SEND_VAL                                                 <array>
          3        SEND_VAL                                                 ''
          4        SEND_REF                                                 !0
          5        DO_FCALL                                      0          
   20     6        INIT_FCALL                                               'print_r'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                                 
          9      > RETURN                                                   1

Function depth_picker:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 7
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 34
Branch analysis from position: 34
2 jumps found. (Code = 44) Position 1 = 37, Position 2 = 9
Branch analysis from position: 37
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 28
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 33
Branch analysis from position: 33
2 jumps found. (Code = 44) Position 1 = 37, Position 2 = 9
Branch analysis from position: 37
Branch analysis from position: 9
Branch analysis from position: 28
2 jumps found. (Code = 44) Position 1 = 37, Position 2 = 9
Branch analysis from position: 37
Branch analysis from position: 9
Branch analysis from position: 7
filename:       /in/iUCk4
function name:  depth_picker
number of ops:  38
compiled vars:  !0 = $arr, !1 = $temp_string, !2 = $collect, !3 = $i, !4 = $arrcopy, !5 = $elem
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
    4     3        IS_NOT_EQUAL                                             !1, ''
          4      > JMPZ                                                     ~6, ->7
    5     5    >   ASSIGN_DIM                                               !2
          6        OP_DATA                                                  !1
    7     7    >   ASSIGN                                                   !3, 0
          8      > JMP                                                      ->34
    8     9    >   ASSIGN                                                   !4, !0
    9    10        INIT_FCALL                                               'array_splice'
         11        SEND_REF                                                 !4
         12        SEND_VAR                                                 !3
         13        SEND_VAL                                                 1
         14        DO_ICALL                                         $10     
         15        ASSIGN                                                   !5, $10
   10    16        COUNT                                            ~12     !4
         17        IS_SMALLER                                               0, ~12
         18      > JMPZ                                                     ~13, ->28
   11    19    >   INIT_FCALL_BY_NAME                                       'depth_picker'
         20        SEND_VAR_EX                                              !4
         21        CONCAT                                           ~14     !1, '+'
         22        FETCH_DIM_R                                      ~15     !5, 0
         23        CONCAT                                           ~16     ~14, ~15
         24        SEND_VAL_EX                                              ~16
         25        SEND_VAR_EX                                              !2
         26        DO_FCALL                                      0          
         27      > JMP                                                      ->33
   13    28    >   CONCAT                                           ~19     !1, '+'
         29        FETCH_DIM_R                                      ~20     !5, 0
         30        CONCAT                                           ~21     ~19, ~20
         31        ASSIGN_DIM                                               !2
         32        OP_DATA                                                  ~21
    7    33    >   PRE_INC                                                  !3
         34    >   COUNT                                            ~23     !0
         35        IS_SMALLER                                               !3, ~23
         36      > JMPNZ                                                    ~24, ->9
   16    37    > > RETURN                                                   null

End of function depth_picker

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.81 ms | 1403 KiB | 18 Q