3v4l.org

run code in 300+ PHP versions simultaneously
<?php function showCombinations($traits, $string = '', $i = 0) { if ($i >= count($traits)) return trim($string) . "\n"; else { foreach ($traits[$i] as $trait) return showCombinations("$string $trait", $traits, $i + 1); } } $traits = array ( array('Happy', 'Sad', 'Angry', 'Hopeful'), array('Outgoing', 'Introverted'), array('Tall', 'Short', 'Medium'), array('Handsome', 'Plain', 'Ugly') ); $combinations = getCombinations($traits); echo $combinations;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/IKnp4
function name:  (null)
number of ops:  7
compiled vars:  !0 = $traits, !1 = $combinations
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   ASSIGN                                                   !0, <array>
   21     1        INIT_FCALL_BY_NAME                                       'getCombinations'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0  $3      
          4        ASSIGN                                                   !1, $3
   23     5        ECHO                                                     !1
          6      > RETURN                                                   1

Function showcombinations:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 12
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
2 jumps found. (Code = 77) Position 1 = 14, Position 2 = 27
Branch analysis from position: 14
2 jumps found. (Code = 78) Position 1 = 15, Position 2 = 27
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 27
filename:       /in/IKnp4
function name:  showCombinations
number of ops:  29
compiled vars:  !0 = $traits, !1 = $string, !2 = $i, !3 = $trait
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      ''
          2        RECV_INIT                                        !2      0
    4     3        COUNT                                            ~4      !0
          4        IS_SMALLER_OR_EQUAL                                      ~4, !2
          5      > JMPZ                                                     ~5, ->12
    5     6    >   INIT_FCALL                                               'trim'
          7        SEND_VAR                                                 !1
          8        DO_ICALL                                         $6      
          9        CONCAT                                           ~7      $6, '%0A'
         10      > RETURN                                                   ~7
         11*       JMP                                                      ->28
    8    12    >   FETCH_DIM_R                                      ~8      !0, !2
         13      > FE_RESET_R                                       $9      ~8, ->27
         14    > > FE_FETCH_R                                               $9, !3, ->27
    9    15    >   INIT_FCALL_BY_NAME                                       'showCombinations'
         16        ROPE_INIT                                     3  ~11     !1
         17        ROPE_ADD                                      1  ~11     ~11, '+'
         18        ROPE_END                                      2  ~10     ~11, !3
         19        SEND_VAL_EX                                              ~10
         20        SEND_VAR_EX                                              !0
         21        ADD                                              ~13     !2, 1
         22        SEND_VAL_EX                                              ~13
         23        DO_FCALL                                      0  $14     
         24        FE_FREE                                                  $9
         25      > RETURN                                                   $14
    8    26*       JMP                                                      ->14
         27    >   FE_FREE                                                  $9
   11    28      > RETURN                                                   null

End of function showcombinations

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.85 ms | 1400 KiB | 15 Q