3v4l.org

run code in 300+ PHP versions simultaneously
<?php function everyCombination($array) { $arrayCount = count($array); $maxCombinations = pow($arrayCount, $arrayCount); $returnArray = array(); $conversionArray = array(); foreach ($array as $key => $value) { $conversionArray[base_convert($key, 10, $arrayCount)] = $value; } for ($i = 0; $i < $maxCombinations; $i++) { $combination = base_convert($i, 10, $arrayCount); $combination = str_pad($combination, $arrayCount, "0", STR_PAD_LEFT); $returnArray[] = strtr($combination, $conversionArray); } return $returnArray; } print_r(everyCombination(array('a', 'b', 'c', 'd'))); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BMapY
function name:  (null)
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   INIT_FCALL                                               'print_r'
          1        INIT_FCALL                                               'everycombination'
          2        SEND_VAL                                                 <array>
          3        DO_FCALL                                      0  $0      
          4        SEND_VAR                                                 $0
          5        DO_ICALL                                                 
   19     6      > RETURN                                                   1

Function everycombination:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 11, Position 2 = 21
Branch analysis from position: 11
2 jumps found. (Code = 78) Position 1 = 12, Position 2 = 21
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 44
Branch analysis from position: 44
2 jumps found. (Code = 44) Position 1 = 46, Position 2 = 24
Branch analysis from position: 46
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
2 jumps found. (Code = 44) Position 1 = 46, Position 2 = 24
Branch analysis from position: 46
Branch analysis from position: 24
Branch analysis from position: 21
filename:       /in/BMapY
function name:  everyCombination
number of ops:  48
compiled vars:  !0 = $array, !1 = $arrayCount, !2 = $maxCombinations, !3 = $returnArray, !4 = $conversionArray, !5 = $value, !6 = $key, !7 = $i, !8 = $combination
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    3     1        COUNT                                            ~9      !0
          2        ASSIGN                                                   !1, ~9
    4     3        INIT_FCALL                                               'pow'
          4        SEND_VAR                                                 !1
          5        SEND_VAR                                                 !1
          6        DO_ICALL                                         $11     
          7        ASSIGN                                                   !2, $11
    5     8        ASSIGN                                                   !3, <array>
    6     9        ASSIGN                                                   !4, <array>
    7    10      > FE_RESET_R                                       $15     !0, ->21
         11    > > FE_FETCH_R                                       ~16     $15, !5, ->21
         12    >   ASSIGN                                                   !6, ~16
    8    13        INIT_FCALL                                               'base_convert'
         14        SEND_VAR                                                 !6
         15        SEND_VAL                                                 10
         16        SEND_VAR                                                 !1
         17        DO_ICALL                                         $18     
         18        ASSIGN_DIM                                               !4, $18
         19        OP_DATA                                                  !5
    7    20      > JMP                                                      ->11
         21    >   FE_FREE                                                  $15
   10    22        ASSIGN                                                   !7, 0
         23      > JMP                                                      ->44
   11    24    >   INIT_FCALL                                               'base_convert'
         25        SEND_VAR                                                 !7
         26        SEND_VAL                                                 10
         27        SEND_VAR                                                 !1
         28        DO_ICALL                                         $21     
         29        ASSIGN                                                   !8, $21
   12    30        INIT_FCALL                                               'str_pad'
         31        SEND_VAR                                                 !8
         32        SEND_VAR                                                 !1
         33        SEND_VAL                                                 '0'
         34        SEND_VAL                                                 0
         35        DO_ICALL                                         $23     
         36        ASSIGN                                                   !8, $23
   13    37        INIT_FCALL                                               'strtr'
         38        SEND_VAR                                                 !8
         39        SEND_VAR                                                 !4
         40        DO_ICALL                                         $26     
         41        ASSIGN_DIM                                               !3
         42        OP_DATA                                                  $26
   10    43        PRE_INC                                                  !7
         44    >   IS_SMALLER                                               !7, !2
         45      > JMPNZ                                                    ~28, ->24
   15    46    > > RETURN                                                   !3
   16    47*     > RETURN                                                   null

End of function everycombination

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.73 ms | 1403 KiB | 24 Q