3v4l.org

run code in 300+ PHP versions simultaneously
<?php function combs($letters) { $result = array_fill(0, count($letters)+1, array()); var_dump($result); $lettersCount = count($letters); for ($i = 0; $i < $lettersCount; ++$i) { for ($j = $lettersCount - $i; $j > 0; --$j) { $result[$j][] = implode(', ', array_slice($letters, $i, $j)); } } array_shift($result); return $result; } $arr = array('a', 'b', 'c', 'd', 'e', 'f'); print_r(combs($arr));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/43aXW
function name:  (null)
number of ops:  8
compiled vars:  !0 = $arr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   ASSIGN                                                   !0, <array>
   18     1        INIT_FCALL                                               'print_r'
          2        INIT_FCALL                                               'combs'
          3        SEND_VAR                                                 !0
          4        DO_FCALL                                      0  $2      
          5        SEND_VAR                                                 $2
          6        DO_ICALL                                                 
          7      > RETURN                                                   1

Function combs:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 35
Branch analysis from position: 35
2 jumps found. (Code = 44) Position 1 = 37, Position 2 = 16
Branch analysis from position: 37
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 32
Branch analysis from position: 32
2 jumps found. (Code = 44) Position 1 = 34, Position 2 = 19
Branch analysis from position: 34
2 jumps found. (Code = 44) Position 1 = 37, Position 2 = 16
Branch analysis from position: 37
Branch analysis from position: 16
Branch analysis from position: 19
2 jumps found. (Code = 44) Position 1 = 34, Position 2 = 19
Branch analysis from position: 34
Branch analysis from position: 19
filename:       /in/43aXW
function name:  combs
number of ops:  42
compiled vars:  !0 = $letters, !1 = $result, !2 = $lettersCount, !3 = $i, !4 = $j
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
    5     1        INIT_FCALL                                               'array_fill'
          2        SEND_VAL                                                 0
          3        COUNT                                            ~5      !0
          4        ADD                                              ~6      ~5, 1
          5        SEND_VAL                                                 ~6
          6        SEND_VAL                                                 <array>
          7        DO_ICALL                                         $7      
          8        ASSIGN                                                   !1, $7
    6     9        INIT_FCALL                                               'var_dump'
         10        SEND_VAR                                                 !1
         11        DO_ICALL                                                 
    7    12        COUNT                                            ~10     !0
         13        ASSIGN                                                   !2, ~10
    8    14        ASSIGN                                                   !3, 0
         15      > JMP                                                      ->35
    9    16    >   SUB                                              ~13     !2, !3
         17        ASSIGN                                                   !4, ~13
         18      > JMP                                                      ->32
   10    19    >   INIT_FCALL                                               'implode'
         20        SEND_VAL                                                 '%2C+'
         21        INIT_FCALL                                               'array_slice'
         22        SEND_VAR                                                 !0
         23        SEND_VAR                                                 !3
         24        SEND_VAR                                                 !4
         25        DO_ICALL                                         $17     
         26        SEND_VAR                                                 $17
         27        DO_ICALL                                         $18     
         28        FETCH_DIM_W                                      $15     !1, !4
         29        ASSIGN_DIM                                               $15
         30        OP_DATA                                                  $18
    9    31        PRE_DEC                                                  !4
         32    >   IS_SMALLER                                               0, !4
         33      > JMPNZ                                                    ~20, ->19
    8    34    >   PRE_INC                                                  !3
         35    >   IS_SMALLER                                               !3, !2
         36      > JMPNZ                                                    ~22, ->16
   13    37    >   INIT_FCALL                                               'array_shift'
         38        SEND_REF                                                 !1
         39        DO_ICALL                                                 
   14    40      > RETURN                                                   !1
   15    41*     > RETURN                                                   null

End of function combs

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.76 ms | 1394 KiB | 26 Q