3v4l.org

run code in 300+ PHP versions simultaneously
<?php function permutation($arr) { while($ele=array_shift($arr)) { $row=array($ele); foreach($arr as $rest) { $row[]=$rest; if(count($row)==2) var_dump($row); } } } permutation(array("1","2","3","4"));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/omNNg
function name:  (null)
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   INIT_FCALL                                               'permutation'
          1        SEND_VAL                                                 <array>
          2        DO_FCALL                                      0          
          3      > RETURN                                                   1

Function permutation:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
2 jumps found. (Code = 44) Position 1 = 21, Position 2 = 2
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 2
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 15
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 15
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 14
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 14
Branch analysis from position: 15
2 jumps found. (Code = 44) Position 1 = 21, Position 2 = 2
Branch analysis from position: 21
Branch analysis from position: 2
Branch analysis from position: 15
filename:       /in/omNNg
function name:  permutation
number of ops:  22
compiled vars:  !0 = $arr, !1 = $row, !2 = $ele, !3 = $rest
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    4     1      > JMP                                                      ->16
    6     2    >   INIT_ARRAY                                       ~4      !2
          3        ASSIGN                                                   !1, ~4
    8     4      > FE_RESET_R                                       $6      !0, ->15
          5    > > FE_FETCH_R                                               $6, !3, ->15
   10     6    >   ASSIGN_DIM                                               !1
          7        OP_DATA                                                  !3
   11     8        COUNT                                            ~8      !1
          9        IS_EQUAL                                                 ~8, 2
         10      > JMPZ                                                     ~9, ->14
         11    >   INIT_FCALL                                               'var_dump'
         12        SEND_VAR                                                 !1
         13        DO_ICALL                                                 
    8    14    > > JMP                                                      ->5
         15    >   FE_FREE                                                  $6
    4    16    >   INIT_FCALL                                               'array_shift'
         17        SEND_REF                                                 !0
         18        DO_ICALL                                         $11     
         19        ASSIGN                                           ~12     !2, $11
         20      > JMPNZ                                                    ~12, ->2
   16    21    > > RETURN                                                   null

End of function permutation

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.75 ms | 1403 KiB | 18 Q