3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array1 = array('A', 'B'); $array2 = array('1', '2', '3'); $num = count($array2); //The total number of possible combinations $total = pow(2, $num); //Loop through each possible combination for ($i = 0; $i < $total; $i++) { //For each combination check if each bit is set for ($j = 0; $j < $num; $j++) { //Is bit $j set in $i? if (pow(2, $j) & $i) $ff = $ff.''.$array2[$j]; } $temp[]=$ff; } print_r($temp);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 29
Branch analysis from position: 29
2 jumps found. (Code = 44) Position 1 = 31, Position 2 = 11
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
2 jumps found. (Code = 44) Position 1 = 26, Position 2 = 13
Branch analysis from position: 26
2 jumps found. (Code = 44) Position 1 = 31, Position 2 = 11
Branch analysis from position: 31
Branch analysis from position: 11
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 23
Branch analysis from position: 19
2 jumps found. (Code = 44) Position 1 = 26, Position 2 = 13
Branch analysis from position: 26
Branch analysis from position: 13
Branch analysis from position: 23
filename:       /in/9nrmH
function name:  (null)
number of ops:  35
compiled vars:  !0 = $array1, !1 = $array2, !2 = $num, !3 = $total, !4 = $i, !5 = $j, !6 = $ff, !7 = $temp
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    3     1        ASSIGN                                                   !1, <array>
    5     2        COUNT                                            ~10     !1
          3        ASSIGN                                                   !2, ~10
    8     4        INIT_FCALL                                               'pow'
          5        SEND_VAL                                                 2
          6        SEND_VAR                                                 !2
          7        DO_ICALL                                         $12     
          8        ASSIGN                                                   !3, $12
   11     9        ASSIGN                                                   !4, 0
         10      > JMP                                                      ->29
   14    11    >   ASSIGN                                                   !5, 0
         12      > JMP                                                      ->24
   17    13    >   INIT_FCALL                                               'pow'
         14        SEND_VAL                                                 2
         15        SEND_VAR                                                 !5
         16        DO_ICALL                                         $16     
         17        BW_AND                                           ~17     !4, $16
         18      > JMPZ                                                     ~17, ->23
         19    >   CONCAT                                           ~18     !6, ''
         20        FETCH_DIM_R                                      ~19     !1, !5
         21        CONCAT                                           ~20     ~18, ~19
         22        ASSIGN                                                   !6, ~20
   14    23    >   PRE_INC                                                  !5
         24    >   IS_SMALLER                                               !5, !2
         25      > JMPNZ                                                    ~23, ->13
   19    26    >   ASSIGN_DIM                                               !7
         27        OP_DATA                                                  !6
   11    28        PRE_INC                                                  !4
         29    >   IS_SMALLER                                               !4, !3
         30      > JMPNZ                                                    ~26, ->11
   22    31    >   INIT_FCALL                                               'print_r'
         32        SEND_VAR                                                 !7
         33        DO_ICALL                                                 
         34      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.57 ms | 1392 KiB | 17 Q