3v4l.org

run code in 300+ PHP versions simultaneously
<?php print_r(ordered_combinations(Array("one", "two", "three", "four"))); function ordered_combinations($array){ if(is_array($array)){ while(count($array) > 0){ foreach($array as $element){ $string = $string . " " . $element; $output[] = $string; } $string = ""; array_shift($array); } return $output; } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iTQmF
function name:  (null)
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'print_r'
          1        INIT_FCALL_BY_NAME                                       'ordered_combinations'
          2        SEND_VAL_EX                                              <array>
          3        DO_FCALL                                      0  $0      
          4        SEND_VAR                                                 $0
          5        DO_ICALL                                                 
   20     6      > RETURN                                                   1

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

End of function ordered_combinations

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.68 ms | 1396 KiB | 17 Q