3v4l.org

run code in 300+ PHP versions simultaneously
<?php function generate_comb($pos, &$res) { global $comb; print_r('{' . $res . '}'); echo "\n"; if ($res != '') { $res = $res . ','; } for ($i = $pos + 1; $i < count($comb); $i++) { $var = $res . $comb[$i]; generate_comb($i, $var); } } $comb = array(1, 2, 3, 4, 5); $pos = -1; $res = ''; generate_comb($pos, $res);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oE0sG
function name:  (null)
number of ops:  8
compiled vars:  !0 = $comb, !1 = $pos, !2 = $res
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   ASSIGN                                                   !0, <array>
   22     1        ASSIGN                                                   !1, -1
   23     2        ASSIGN                                                   !2, ''
   25     3        INIT_FCALL                                               'generate_comb'
          4        SEND_VAR                                                 !1
          5        SEND_REF                                                 !2
          6        DO_FCALL                                      0          
          7      > RETURN                                                   1

Function generate_comb:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 13
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 = 27, Position 2 = 16
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
2 jumps found. (Code = 44) Position 1 = 27, Position 2 = 16
Branch analysis from position: 27
Branch analysis from position: 16
Branch analysis from position: 13
filename:       /in/oE0sG
function name:  generate_comb
number of ops:  28
compiled vars:  !0 = $pos, !1 = $res, !2 = $comb, !3 = $i, !4 = $var
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    5     2        BIND_GLOBAL                                              !2, 'comb'
    7     3        INIT_FCALL                                               'print_r'
          4        CONCAT                                           ~5      '%7B', !1
          5        CONCAT                                           ~6      ~5, '%7D'
          6        SEND_VAL                                                 ~6
          7        DO_ICALL                                                 
    8     8        ECHO                                                     '%0A'
    9     9        IS_NOT_EQUAL                                             !1, ''
         10      > JMPZ                                                     ~8, ->13
   10    11    >   CONCAT                                           ~9      !1, '%2C'
         12        ASSIGN                                                   !1, ~9
   13    13    >   ADD                                              ~11     !0, 1
         14        ASSIGN                                                   !3, ~11
         15      > JMP                                                      ->24
   14    16    >   FETCH_DIM_R                                      ~13     !2, !3
         17        CONCAT                                           ~14     !1, ~13
         18        ASSIGN                                                   !4, ~14
   15    19        INIT_FCALL_BY_NAME                                       'generate_comb'
         20        SEND_VAR_EX                                              !3
         21        SEND_VAR_EX                                              !4
         22        DO_FCALL                                      0          
   13    23        PRE_INC                                                  !3
         24    >   COUNT                                            ~18     !2
         25        IS_SMALLER                                               !3, ~18
         26      > JMPNZ                                                    ~19, ->16
   18    27    > > RETURN                                                   null

End of function generate_comb

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.95 ms | 1403 KiB | 16 Q