3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); error_reporting(-1); ini_set('display_errors', 'On'); function pwr(array $elements, int $k, int $idx = 0, array &$result = []): \Generator { foreach ($elements as $element) { $result[$idx] = $element; if ($k - $idx > 1) { yield from pwr($elements, $k, $idx + 1, $result); } else { yield $result; } } } function gen(array $keys, array $values): \Generator { foreach (pwr($values, \count($keys)) as $set) { yield array_combine($keys, $set); } } foreach (gen(range('a', 'j'), [true, false]) as $case) { foreach ($case as $k => $v) { echo $v ? $k : '_'; } echo "\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 16, Position 2 = 29
Branch analysis from position: 16
2 jumps found. (Code = 78) Position 1 = 17, Position 2 = 29
Branch analysis from position: 17
2 jumps found. (Code = 77) Position 1 = 18, Position 2 = 26
Branch analysis from position: 18
2 jumps found. (Code = 78) Position 1 = 19, Position 2 = 26
Branch analysis from position: 19
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 23
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
Branch analysis from position: 26
Branch analysis from position: 29
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
filename:       /in/l5PRo
function name:  (null)
number of ops:  31
compiled vars:  !0 = $case, !1 = $v, !2 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   INIT_FCALL                                               'error_reporting'
          1        SEND_VAL                                                 -1
          2        DO_ICALL                                                 
    5     3        INIT_FCALL                                               'ini_set'
          4        SEND_VAL                                                 'display_errors'
          5        SEND_VAL                                                 'On'
          6        DO_ICALL                                                 
   28     7        INIT_FCALL                                               'gen'
          8        INIT_FCALL                                               'range'
          9        SEND_VAL                                                 'a'
         10        SEND_VAL                                                 'j'
         11        DO_ICALL                                         $5      
         12        SEND_VAR                                                 $5
         13        SEND_VAL                                                 <array>
         14        DO_FCALL                                      0  $6      
         15      > FE_RESET_R                                       $7      $6, ->29
         16    > > FE_FETCH_R                                               $7, !0, ->29
   29    17    > > FE_RESET_R                                       $8      !0, ->26
         18    > > FE_FETCH_R                                       ~9      $8, !1, ->26
         19    >   ASSIGN                                                   !2, ~9
   30    20      > JMPZ                                                     !1, ->23
         21    >   QM_ASSIGN                                        ~11     !2
         22      > JMP                                                      ->24
         23    >   QM_ASSIGN                                        ~11     '_'
         24    >   ECHO                                                     ~11
   29    25      > JMP                                                      ->18
         26    >   FE_FREE                                                  $8
   33    27        ECHO                                                     '%0A'
   28    28      > JMP                                                      ->16
         29    >   FE_FREE                                                  $7
   34    30      > RETURN                                                   1

Function pwr:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 24
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 24
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 22
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 24
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 24
filename:       /in/l5PRo
function name:  pwr
number of ops:  26
compiled vars:  !0 = $elements, !1 = $k, !2 = $idx, !3 = $result, !4 = $element
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV_INIT                                        !2      0
          3        RECV_INIT                                        !3      <array>
          4        GENERATOR_CREATE                                         
    9     5      > FE_RESET_R                                       $5      !0, ->24
          6    > > FE_FETCH_R                                               $5, !4, ->24
   10     7    >   ASSIGN_DIM                                               !3, !2
          8        OP_DATA                                                  !4
   12     9        SUB                                              ~7      !1, !2
         10        IS_SMALLER                                               1, ~7
         11      > JMPZ                                                     ~8, ->22
   13    12    >   INIT_FCALL_BY_NAME                                       'pwr'
         13        SEND_VAR_EX                                              !0
         14        SEND_VAR_EX                                              !1
         15        ADD                                              ~9      !2, 1
         16        SEND_VAL_EX                                              ~9
         17        SEND_VAR_EX                                              !3
         18        DO_FCALL                                      0  $10     
         19        YIELD_FROM                                       ~11     $10
         20        FREE                                                     ~11
         21      > JMP                                                      ->23
   16    22    >   YIELD                                                    !3
    9    23    > > JMP                                                      ->6
         24    >   FE_FREE                                                  $5
   19    25      > GENERATOR_RETURN                                         

End of function pwr

Function gen:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 9, Position 2 = 16
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 16
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 16
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 16
filename:       /in/l5PRo
function name:  gen
number of ops:  18
compiled vars:  !0 = $keys, !1 = $values, !2 = $set
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        GENERATOR_CREATE                                         
   23     3        INIT_FCALL                                               'pwr'
          4        SEND_VAR                                                 !1
          5        COUNT                                            ~3      !0
          6        SEND_VAL                                                 ~3
          7        DO_FCALL                                      0  $4      
          8      > FE_RESET_R                                       $5      $4, ->16
          9    > > FE_FETCH_R                                               $5, !2, ->16
   24    10    >   INIT_FCALL                                               'array_combine'
         11        SEND_VAR                                                 !0
         12        SEND_VAR                                                 !2
         13        DO_ICALL                                         $6      
         14        YIELD                                                    $6
   23    15      > JMP                                                      ->9
         16    >   FE_FREE                                                  $5
   26    17      > GENERATOR_RETURN                                         

End of function gen

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.75 ms | 1411 KiB | 23 Q