3v4l.org

run code in 300+ PHP versions simultaneously
<?php $option_array[] = [ 'Condition' => [ 'nm' => 'Near Mint/Mint', 'sp' => 'Slightly Played', 'hp' => 'Heavily PLayed' ], 'Style' => [ 'normal' => 'Normal', 'foil' => 'Foil' ] ]; $N = 1; foreach ($option_array as $options) $N *= count($options); $all_combinations = array(); for( $i = 0 ; $i < $N ; ++$i ) { $all_combinations[$i] = array(); $q = $i; for( $j = count($option_array)-1 ; 0 <= $j ; --$j ) { $opt = $option_array[$j]; $nopts = count($opt['options']); $all_combinations[$i][$opt['name']] = $opt['options'][$q % $nopts]; $q = floor($q / $nopts); } } print_r( $all_combinations );
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 8
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 8
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 40
Branch analysis from position: 40
2 jumps found. (Code = 44) Position 1 = 42, Position 2 = 12
Branch analysis from position: 42
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 37
Branch analysis from position: 37
2 jumps found. (Code = 44) Position 1 = 39, Position 2 = 19
Branch analysis from position: 39
2 jumps found. (Code = 44) Position 1 = 42, Position 2 = 12
Branch analysis from position: 42
Branch analysis from position: 12
Branch analysis from position: 19
2 jumps found. (Code = 44) Position 1 = 39, Position 2 = 19
Branch analysis from position: 39
Branch analysis from position: 19
Branch analysis from position: 8
filename:       /in/subUv
function name:  (null)
number of ops:  46
compiled vars:  !0 = $option_array, !1 = $N, !2 = $options, !3 = $all_combinations, !4 = $i, !5 = $q, !6 = $j, !7 = $opt, !8 = $nopts
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN_DIM                                               !0
    4     1        OP_DATA                                                  <array>
   14     2        ASSIGN                                                   !1, 1
   15     3      > FE_RESET_R                                       $11     !0, ->8
          4    > > FE_FETCH_R                                               $11, !2, ->8
          5    >   COUNT                                            ~12     !2
          6        ASSIGN_OP                                     3          !1, ~12
          7      > JMP                                                      ->4
          8    >   FE_FREE                                                  $11
   17     9        ASSIGN                                                   !3, <array>
   19    10        ASSIGN                                                   !4, 0
         11      > JMP                                                      ->40
   21    12    >   ASSIGN_DIM                                               !3, !4
         13        OP_DATA                                                  <array>
   22    14        ASSIGN                                                   !5, !4
   23    15        COUNT                                            ~18     !0
         16        SUB                                              ~19     ~18, 1
         17        ASSIGN                                                   !6, ~19
         18      > JMP                                                      ->37
   25    19    >   FETCH_DIM_R                                      ~21     !0, !6
         20        ASSIGN                                                   !7, ~21
   26    21        FETCH_DIM_R                                      ~23     !7, 'options'
         22        COUNT                                            ~24     ~23
         23        ASSIGN                                                   !8, ~24
   27    24        FETCH_DIM_R                                      ~27     !7, 'name'
         25        MOD                                              ~30     !5, !8
         26        FETCH_DIM_R                                      ~29     !7, 'options'
         27        FETCH_DIM_R                                      ~31     ~29, ~30
         28        FETCH_DIM_W                                      $26     !3, !4
         29        ASSIGN_DIM                                               $26, ~27
         30        OP_DATA                                                  ~31
   28    31        INIT_FCALL                                               'floor'
         32        DIV                                              ~32     !5, !8
         33        SEND_VAL                                                 ~32
         34        DO_ICALL                                         $33     
         35        ASSIGN                                                   !5, $33
   23    36        PRE_DEC                                                  !6
         37    >   IS_SMALLER_OR_EQUAL                                      0, !6
         38      > JMPNZ                                                    ~36, ->19
   19    39    >   PRE_INC                                                  !4
         40    >   IS_SMALLER                                               !4, !1
         41      > JMPNZ                                                    ~38, ->12
   32    42    >   INIT_FCALL                                               'print_r'
         43        SEND_VAR                                                 !3
         44        DO_ICALL                                                 
         45      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.33 ms | 1400 KiB | 17 Q