3v4l.org

run code in 300+ PHP versions simultaneously
<?php function permutation(array $arr) { $out = array(); while($ele=array_shift($arr)) { $x=$ele; //echo $x."\n"; foreach($arr as $rest) { $x.=" $rest"; //echo $x."\n"; array_push($out, $x); } } foreach($out as $o) { echo $o; } } permutation(array("Rafting","Hiking","Running","Biking"));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QGeKc
function name:  (null)
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     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 = 15
Branch analysis from position: 15
2 jumps found. (Code = 44) Position 1 = 20, Position 2 = 3
Branch analysis from position: 20
2 jumps found. (Code = 77) Position 1 = 21, Position 2 = 24
Branch analysis from position: 21
2 jumps found. (Code = 78) Position 1 = 22, Position 2 = 24
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
Branch analysis from position: 3
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 14
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 14
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 14
2 jumps found. (Code = 44) Position 1 = 20, Position 2 = 3
Branch analysis from position: 20
Branch analysis from position: 3
Branch analysis from position: 14
filename:       /in/QGeKc
function name:  permutation
number of ops:  26
compiled vars:  !0 = $arr, !1 = $out, !2 = $x, !3 = $ele, !4 = $rest, !5 = $o
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    4     1        ASSIGN                                                   !1, <array>
    5     2      > JMP                                                      ->15
    7     3    >   ASSIGN                                                   !2, !3
    9     4      > FE_RESET_R                                       $8      !0, ->14
          5    > > FE_FETCH_R                                               $8, !4, ->14
   11     6    >   NOP                                                      
          7        FAST_CONCAT                                      ~9      '+', !4
          8        ASSIGN_OP                                     8          !2, ~9
   13     9        INIT_FCALL                                               'array_push'
         10        SEND_REF                                                 !1
         11        SEND_VAR                                                 !2
         12        DO_ICALL                                                 
    9    13      > JMP                                                      ->5
         14    >   FE_FREE                                                  $8
    5    15    >   INIT_FCALL                                               'array_shift'
         16        SEND_REF                                                 !0
         17        DO_ICALL                                         $12     
         18        ASSIGN                                           ~13     !3, $12
         19      > JMPNZ                                                    ~13, ->3
   16    20    > > FE_RESET_R                                       $14     !1, ->24
         21    > > FE_FETCH_R                                               $14, !5, ->24
   18    22    >   ECHO                                                     !5
   16    23      > JMP                                                      ->21
         24    >   FE_FREE                                                  $14
   20    25      > RETURN                                                   null

End of function permutation

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.78 ms | 1407 KiB | 18 Q