3v4l.org

run code in 300+ PHP versions simultaneously
<?php function combs($letters) { $result = array(); //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/MrS0H
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 = 28
Branch analysis from position: 28
2 jumps found. (Code = 44) Position 1 = 30, Position 2 = 9
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 25
Branch analysis from position: 25
2 jumps found. (Code = 44) Position 1 = 27, Position 2 = 12
Branch analysis from position: 27
2 jumps found. (Code = 44) Position 1 = 30, Position 2 = 9
Branch analysis from position: 30
Branch analysis from position: 9
Branch analysis from position: 12
2 jumps found. (Code = 44) Position 1 = 27, Position 2 = 12
Branch analysis from position: 27
Branch analysis from position: 12
filename:       /in/MrS0H
function name:  combs
number of ops:  35
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        ASSIGN                                                   !1, <array>
    6     2        INIT_FCALL                                               'var_dump'
          3        SEND_VAR                                                 !1
          4        DO_ICALL                                                 
    7     5        COUNT                                            ~7      !0
          6        ASSIGN                                                   !2, ~7
    8     7        ASSIGN                                                   !3, 0
          8      > JMP                                                      ->28
    9     9    >   SUB                                              ~10     !2, !3
         10        ASSIGN                                                   !4, ~10
         11      > JMP                                                      ->25
   10    12    >   INIT_FCALL                                               'implode'
         13        SEND_VAL                                                 '%2C+'
         14        INIT_FCALL                                               'array_slice'
         15        SEND_VAR                                                 !0
         16        SEND_VAR                                                 !3
         17        SEND_VAR                                                 !4
         18        DO_ICALL                                         $14     
         19        SEND_VAR                                                 $14
         20        DO_ICALL                                         $15     
         21        FETCH_DIM_W                                      $12     !1, !4
         22        ASSIGN_DIM                                               $12
         23        OP_DATA                                                  $15
    9    24        PRE_DEC                                                  !4
         25    >   IS_SMALLER                                               0, !4
         26      > JMPNZ                                                    ~17, ->12
    8    27    >   PRE_INC                                                  !3
         28    >   IS_SMALLER                                               !3, !2
         29      > JMPNZ                                                    ~19, ->9
   13    30    >   INIT_FCALL                                               'array_shift'
         31        SEND_REF                                                 !1
         32        DO_ICALL                                                 
   14    33      > RETURN                                                   !1
   15    34*     > RETURN                                                   null

End of function combs

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.23 ms | 1403 KiB | 24 Q