3v4l.org

run code in 300+ PHP versions simultaneously
<?php $words=array("Casa", "perro", "abad"); print_r(getAllWordCombos($words)); function getAllWordCombos($words) { if (count($words)==1) return array($words); else if (count($words)==2) return array(array($words[0], $words[1]), array($words[1],$words[0])); else { $ret=array(); foreach($words as $i=>$firstword) { $cwords=array_slice($words,0); array_splice($cwords,$i); $combos=getAllWordCombos($cwords); $head=array($firstword); foreach ($combos as $combo) { $ret[]=array_merge($head,$combo); } } return $ret; } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vESoO
function name:  (null)
number of ops:  8
compiled vars:  !0 = $words
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        INIT_FCALL                                               'print_r'
          2        INIT_FCALL_BY_NAME                                       'getAllWordCombos'
          3        SEND_VAR_EX                                              !0
          4        DO_FCALL                                      0  $2      
          5        SEND_VAR                                                 $2
          6        DO_ICALL                                                 
   23     7      > RETURN                                                   1

Function getallwordcombos:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 7
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 22
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
2 jumps found. (Code = 77) Position 1 = 24, Position 2 = 52
Branch analysis from position: 24
2 jumps found. (Code = 78) Position 1 = 25, Position 2 = 52
Branch analysis from position: 25
2 jumps found. (Code = 77) Position 1 = 42, Position 2 = 50
Branch analysis from position: 42
2 jumps found. (Code = 78) Position 1 = 43, Position 2 = 50
Branch analysis from position: 43
1 jumps found. (Code = 42) Position 1 = 42
Branch analysis from position: 42
Branch analysis from position: 50
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
Branch analysis from position: 50
Branch analysis from position: 52
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 52
filename:       /in/vESoO
function name:  getAllWordCombos
number of ops:  55
compiled vars:  !0 = $words, !1 = $ret, !2 = $firstword, !3 = $i, !4 = $cwords, !5 = $combos, !6 = $head, !7 = $combo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    8     1        COUNT                                            ~8      !0
          2        IS_EQUAL                                                 ~8, 1
          3      > JMPZ                                                     ~9, ->7
          4    >   INIT_ARRAY                                       ~10     !0
          5      > RETURN                                                   ~10
          6*       JMP                                                      ->54
    9     7    >   COUNT                                            ~11     !0
          8        IS_EQUAL                                                 ~11, 2
          9      > JMPZ                                                     ~12, ->22
         10    >   FETCH_DIM_R                                      ~13     !0, 0
         11        INIT_ARRAY                                       ~14     ~13
         12        FETCH_DIM_R                                      ~15     !0, 1
         13        ADD_ARRAY_ELEMENT                                ~14     ~15
         14        INIT_ARRAY                                       ~16     ~14
         15        FETCH_DIM_R                                      ~17     !0, 1
         16        INIT_ARRAY                                       ~18     ~17
         17        FETCH_DIM_R                                      ~19     !0, 0
         18        ADD_ARRAY_ELEMENT                                ~18     ~19
         19        ADD_ARRAY_ELEMENT                                ~16     ~18
         20      > RETURN                                                   ~16
         21*       JMP                                                      ->54
   11    22    >   ASSIGN                                                   !1, <array>
   12    23      > FE_RESET_R                                       $21     !0, ->52
         24    > > FE_FETCH_R                                       ~22     $21, !2, ->52
         25    >   ASSIGN                                                   !3, ~22
   13    26        INIT_FCALL                                               'array_slice'
         27        SEND_VAR                                                 !0
         28        SEND_VAL                                                 0
         29        DO_ICALL                                         $24     
         30        ASSIGN                                                   !4, $24
   14    31        INIT_FCALL                                               'array_splice'
         32        SEND_REF                                                 !4
         33        SEND_VAR                                                 !3
         34        DO_ICALL                                                 
   15    35        INIT_FCALL_BY_NAME                                       'getAllWordCombos'
         36        SEND_VAR_EX                                              !4
         37        DO_FCALL                                      0  $27     
         38        ASSIGN                                                   !5, $27
   16    39        INIT_ARRAY                                       ~29     !2
         40        ASSIGN                                                   !6, ~29
   17    41      > FE_RESET_R                                       $31     !5, ->50
         42    > > FE_FETCH_R                                               $31, !7, ->50
   18    43    >   INIT_FCALL                                               'array_merge'
         44        SEND_VAR                                                 !6
         45        SEND_VAR                                                 !7
         46        DO_ICALL                                         $33     
         47        ASSIGN_DIM                                               !1
         48        OP_DATA                                                  $33
   17    49      > JMP                                                      ->42
         50    >   FE_FREE                                                  $31
   12    51      > JMP                                                      ->24
         52    >   FE_FREE                                                  $21
   21    53      > RETURN                                                   !1
   23    54*     > RETURN                                                   null

End of function getallwordcombos

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.88 ms | 1405 KiB | 21 Q