3v4l.org

run code in 300+ PHP versions simultaneously
<?php function createCombinations($input, $length) { foreach($input as $c) { if($length == 1) { yield $c; return; } else { foreach(createCombinations($input, $length -1) as $s) { yield $c + $s; return; } } } } $texte = "abcdefghijklmnopqrstuvwxyz0123456789"; $input = str_split($texte ); $generator = createCombinations($input, 4); foreach($generator as $result) { echo $result; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 11, Position 2 = 14
Branch analysis from position: 11
2 jumps found. (Code = 78) Position 1 = 12, Position 2 = 14
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
filename:       /in/tvbJt
function name:  (null)
number of ops:  16
compiled vars:  !0 = $texte, !1 = $input, !2 = $generator, !3 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   ASSIGN                                                   !0, 'abcdefghijklmnopqrstuvwxyz0123456789'
   22     1        INIT_FCALL                                               'str_split'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $5      
          4        ASSIGN                                                   !1, $5
   23     5        INIT_FCALL                                               'createcombinations'
          6        SEND_VAR                                                 !1
          7        SEND_VAL                                                 4
          8        DO_FCALL                                      0  $7      
          9        ASSIGN                                                   !2, $7
   24    10      > FE_RESET_R                                       $9      !2, ->14
         11    > > FE_FETCH_R                                               $9, !3, ->14
   25    12    >   ECHO                                                     !3
   24    13      > JMP                                                      ->11
         14    >   FE_FREE                                                  $9
   26    15      > RETURN                                                   1

Function createcombinations:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 26
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 26
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 11
Branch analysis from position: 7
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 11
2 jumps found. (Code = 77) Position 1 = 17, Position 2 = 24
Branch analysis from position: 17
2 jumps found. (Code = 78) Position 1 = 18, Position 2 = 24
Branch analysis from position: 18
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 24
Branch analysis from position: 26
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 26
filename:       /in/tvbJt
function name:  createCombinations
number of ops:  28
compiled vars:  !0 = $input, !1 = $length, !2 = $c, !3 = $s
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        GENERATOR_CREATE                                         
    6     3      > FE_RESET_R                                       $4      !0, ->26
          4    > > FE_FETCH_R                                               $4, !2, ->26
    7     5    >   IS_EQUAL                                                 !1, 1
          6      > JMPZ                                                     ~5, ->11
    8     7    >   YIELD                                                    !2
    9     8        FE_FREE                                                  $4
          9      > GENERATOR_RETURN                                         
         10*       JMP                                                      ->25
   13    11    >   INIT_FCALL_BY_NAME                                       'createCombinations'
         12        SEND_VAR_EX                                              !0
         13        SUB                                              ~7      !1, 1
         14        SEND_VAL_EX                                              ~7
         15        DO_FCALL                                      0  $8      
         16      > FE_RESET_R                                       $9      $8, ->24
         17    > > FE_FETCH_R                                               $9, !3, ->24
   14    18    >   ADD                                              ~10     !2, !3
         19        YIELD                                                    ~10
   15    20        FE_FREE                                                  $9
         21        FE_FREE                                                  $4
         22      > GENERATOR_RETURN                                         
   13    23*       JMP                                                      ->17
         24    >   FE_FREE                                                  $9
    6    25      > JMP                                                      ->4
         26    >   FE_FREE                                                  $4
   19    27      > GENERATOR_RETURN                                         

End of function createcombinations

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.41 ms | 1403 KiB | 16 Q