3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input = "hello everybody at here"; $array = explode(" ",$input); function permutation($arr, $ts, &$newArray) { if ($ts != "") $newArray[] = $ts; for ($i = 0; $i < count($arr); $i++) { $temp = $arr; $elem = array_splice($temp, $i, 1); if (count($temp) > 0) { permutation($temp, $ts . " " . $elem[0], $newArray); } else { $newArray[] = $ts . " " . $elem[0]; } } } $newArray = []; permutation($array, "", $newArray); echo '<pre>'; print_r($newArray);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OP5XD
function name:  (null)
number of ops:  17
compiled vars:  !0 = $input, !1 = $array, !2 = $newArray
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'hello+everybody+at+here'
    4     1        INIT_FCALL                                               'explode'
          2        SEND_VAL                                                 '+'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $4      
          5        ASSIGN                                                   !1, $4
   22     6        ASSIGN                                                   !2, <array>
   23     7        INIT_FCALL                                               'permutation'
          8        SEND_VAR                                                 !1
          9        SEND_VAL                                                 ''
         10        SEND_REF                                                 !2
         11        DO_FCALL                                      0          
   24    12        ECHO                                                     '%3Cpre%3E'
   25    13        INIT_FCALL                                               'print_r'
         14        SEND_VAR                                                 !2
         15        DO_ICALL                                                 
         16      > RETURN                                                   1

Function permutation:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 7
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 34
Branch analysis from position: 34
2 jumps found. (Code = 44) Position 1 = 37, Position 2 = 9
Branch analysis from position: 37
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 28
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 33
Branch analysis from position: 33
2 jumps found. (Code = 44) Position 1 = 37, Position 2 = 9
Branch analysis from position: 37
Branch analysis from position: 9
Branch analysis from position: 28
2 jumps found. (Code = 44) Position 1 = 37, Position 2 = 9
Branch analysis from position: 37
Branch analysis from position: 9
Branch analysis from position: 7
filename:       /in/OP5XD
function name:  permutation
number of ops:  38
compiled vars:  !0 = $arr, !1 = $ts, !2 = $newArray, !3 = $i, !4 = $temp, !5 = $elem
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
    8     3        IS_NOT_EQUAL                                             !1, ''
          4      > JMPZ                                                     ~6, ->7
    9     5    >   ASSIGN_DIM                                               !2
          6        OP_DATA                                                  !1
   11     7    >   ASSIGN                                                   !3, 0
          8      > JMP                                                      ->34
   12     9    >   ASSIGN                                                   !4, !0
   13    10        INIT_FCALL                                               'array_splice'
         11        SEND_REF                                                 !4
         12        SEND_VAR                                                 !3
         13        SEND_VAL                                                 1
         14        DO_ICALL                                         $10     
         15        ASSIGN                                                   !5, $10
   14    16        COUNT                                            ~12     !4
         17        IS_SMALLER                                               0, ~12
         18      > JMPZ                                                     ~13, ->28
   15    19    >   INIT_FCALL_BY_NAME                                       'permutation'
         20        SEND_VAR_EX                                              !4
         21        CONCAT                                           ~14     !1, '+'
         22        FETCH_DIM_R                                      ~15     !5, 0
         23        CONCAT                                           ~16     ~14, ~15
         24        SEND_VAL_EX                                              ~16
         25        SEND_VAR_EX                                              !2
         26        DO_FCALL                                      0          
   14    27      > JMP                                                      ->33
   17    28    >   CONCAT                                           ~19     !1, '+'
         29        FETCH_DIM_R                                      ~20     !5, 0
         30        CONCAT                                           ~21     ~19, ~20
         31        ASSIGN_DIM                                               !2
         32        OP_DATA                                                  ~21
   11    33    >   PRE_INC                                                  !3
         34    >   COUNT                                            ~23     !0
         35        IS_SMALLER                                               !3, ~23
         36      > JMPNZ                                                    ~24, ->9
   20    37    > > RETURN                                                   null

End of function permutation

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.47 ms | 1011 KiB | 17 Q