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['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 = 9
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 9
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 41
Branch analysis from position: 41
2 jumps found. (Code = 44) Position 1 = 43, Position 2 = 13
Branch analysis from position: 43
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 38
Branch analysis from position: 38
2 jumps found. (Code = 44) Position 1 = 40, Position 2 = 20
Branch analysis from position: 40
2 jumps found. (Code = 44) Position 1 = 43, Position 2 = 13
Branch analysis from position: 43
Branch analysis from position: 13
Branch analysis from position: 20
2 jumps found. (Code = 44) Position 1 = 40, Position 2 = 20
Branch analysis from position: 40
Branch analysis from position: 20
Branch analysis from position: 9
filename:       /in/SYqjc
function name:  (null)
number of ops:  47
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, ->9
          4    > > FE_FETCH_R                                               $11, !2, ->9
          5    >   FETCH_DIM_R                                      ~12     !2, 'options'
          6        COUNT                                            ~13     ~12
          7        ASSIGN_OP                                     3          !1, ~13
          8      > JMP                                                      ->4
          9    >   FE_FREE                                                  $11
   17    10        ASSIGN                                                   !3, <array>
   19    11        ASSIGN                                                   !4, 0
         12      > JMP                                                      ->41
   21    13    >   ASSIGN_DIM                                               !3, !4
         14        OP_DATA                                                  <array>
   22    15        ASSIGN                                                   !5, !4
   23    16        COUNT                                            ~19     !0
         17        SUB                                              ~20     ~19, 1
         18        ASSIGN                                                   !6, ~20
         19      > JMP                                                      ->38
   25    20    >   FETCH_DIM_R                                      ~22     !0, !6
         21        ASSIGN                                                   !7, ~22
   26    22        FETCH_DIM_R                                      ~24     !7, 'options'
         23        COUNT                                            ~25     ~24
         24        ASSIGN                                                   !8, ~25
   27    25        FETCH_DIM_R                                      ~28     !7, 'name'
         26        MOD                                              ~31     !5, !8
         27        FETCH_DIM_R                                      ~30     !7, 'options'
         28        FETCH_DIM_R                                      ~32     ~30, ~31
         29        FETCH_DIM_W                                      $27     !3, !4
         30        ASSIGN_DIM                                               $27, ~28
         31        OP_DATA                                                  ~32
   28    32        INIT_FCALL                                               'floor'
         33        DIV                                              ~33     !5, !8
         34        SEND_VAL                                                 ~33
         35        DO_ICALL                                         $34     
         36        ASSIGN                                                   !5, $34
   23    37        PRE_DEC                                                  !6
         38    >   IS_SMALLER_OR_EQUAL                                      0, !6
         39      > JMPNZ                                                    ~37, ->20
   19    40    >   PRE_INC                                                  !4
         41    >   IS_SMALLER                                               !4, !1
         42      > JMPNZ                                                    ~39, ->13
   32    43    >   INIT_FCALL                                               'print_r'
         44        SEND_VAR                                                 !3
         45        DO_ICALL                                                 
         46      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.71 ms | 1400 KiB | 17 Q