3v4l.org

run code in 500+ PHP versions simultaneously
<?php declare(strict_types=1); /** * @param array $elements * @param array $extra * * @return Generator */ function gen(array $elements, array $extra = []): \Generator { foreach ($elements as $i => $head) { foreach (gen(array_slice($elements, $i + 1), $extra) as $tail) { yield array_merge([$head], $tail); } } yield $extra; } foreach (gen(['O', 'U', 'W', 'P'], ['template']) as $path) { echo implode(' / ', $path), "\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 10
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 10
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
filename:       /in/gJB8q
function name:  (null)
number of ops:  12
compiled vars:  !0 = $path
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   21     0  E >   INIT_FCALL                                                   'gen'
          1        SEND_VAL                                                     <array>
          2        SEND_VAL                                                     <array>
          3        DO_FCALL                                          0  $1      
          4      > FE_RESET_R                                           $2      $1, ->10
          5    > > FE_FETCH_R                                                   $2, !0, ->10
   22     6    >   FRAMELESS_ICALL_2                implode             ~3      '+%2F+', !0
          7        ECHO                                                         ~3
          8        ECHO                                                         '%0A'
   21     9      > JMP                                                          ->5
         10    >   FE_FREE                                                      $2
   23    11      > RETURN                                                       1

Function gen:
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 = 77) Position 1 = 16, Position 2 = 24
Branch analysis from position: 16
2 jumps found. (Code = 78) Position 1 = 17, Position 2 = 24
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
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/gJB8q
function name:  gen
number of ops:  29
compiled vars:  !0 = $elements, !1 = $extra, !2 = $head, !3 = $i, !4 = $tail
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   10     0  E >   RECV                                                 !0      
          1        RECV_INIT                                            !1      <array>
          2        GENERATOR_CREATE                                             
   12     3      > FE_RESET_R                                           $5      !0, ->26
          4    > > FE_FETCH_R                                           ~6      $5, !2, ->26
          5    >   ASSIGN                                                       !3, ~6
   13     6        INIT_FCALL_BY_NAME                                           'gen'
          7        INIT_FCALL                                                   'array_slice'
          8        SEND_VAR                                                     !0
          9        ADD                                                  ~8      !3, 1
         10        SEND_VAL                                                     ~8
         11        DO_ICALL                                             $9      
         12        SEND_VAR_NO_REF_EX                                           $9
         13        SEND_VAR_EX                                                  !1
         14        DO_FCALL                                          0  $10     
         15      > FE_RESET_R                                           $11     $10, ->24
         16    > > FE_FETCH_R                                                   $11, !4, ->24
   14    17    >   INIT_FCALL                                                   'array_merge'
         18        INIT_ARRAY                                           ~12     !2
         19        SEND_VAL                                                     ~12
         20        SEND_VAR                                                     !4
         21        DO_ICALL                                             $13     
         22        YIELD                                                        $13
   13    23      > JMP                                                          ->16
         24    >   FE_FREE                                                      $11
   12    25      > JMP                                                          ->4
         26    >   FE_FREE                                                      $5
   18    27        YIELD                                                        !1
   19    28      > GENERATOR_RETURN                                             

End of function gen

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
162.05 ms | 2640 KiB | 16 Q