3v4l.org

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

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

End of function createcombinations

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
183.3 ms | 1394 KiB | 16 Q