3v4l.org

run code in 300+ PHP versions simultaneously
<?php $myArray = array ( 14 => array ( 0 => 29, 1 => 129 ), 193 => array ( 0 => 6009231, 1 => 6324415, 2 => 5682922 ), 256 => array ( 0 => 3, 1 => 234 ), 999 => array ( 0 => 111, 1 => 222) ); function list_values($array) { $output = array(); $k1 = array_keys($array)[0]; if (count($array) == 1) { foreach ($array[$k1] as $v1) { $output[] = "$k1:$v1"; } } else { foreach ($array[$k1] as $v1) { foreach (list_values(array_slice($array, 1, null, true)) as $k2 => $v2) { $output[] = "$k1:$v1;$v2"; } } } return $output; } print_r(list_values($myArray));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/f47kM
function name:  (null)
number of ops:  8
compiled vars:  !0 = $myArray
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   44     1        INIT_FCALL                                               'print_r'
          2        INIT_FCALL                                               'list_values'
          3        SEND_VAR                                                 !0
          4        DO_FCALL                                      0  $2      
          5        SEND_VAR                                                 $2
          6        DO_ICALL                                                 
          7      > RETURN                                                   1

Function list_values:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 21
Branch analysis from position: 10
2 jumps found. (Code = 77) Position 1 = 12, Position 2 = 19
Branch analysis from position: 12
2 jumps found. (Code = 78) Position 1 = 13, Position 2 = 19
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 47
Branch analysis from position: 47
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
Branch analysis from position: 21
2 jumps found. (Code = 77) Position 1 = 23, Position 2 = 46
Branch analysis from position: 23
2 jumps found. (Code = 78) Position 1 = 24, Position 2 = 46
Branch analysis from position: 24
2 jumps found. (Code = 77) Position 1 = 34, Position 2 = 44
Branch analysis from position: 34
2 jumps found. (Code = 78) Position 1 = 35, Position 2 = 44
Branch analysis from position: 35
1 jumps found. (Code = 42) Position 1 = 34
Branch analysis from position: 34
Branch analysis from position: 44
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
Branch analysis from position: 44
Branch analysis from position: 46
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 46
filename:       /in/f47kM
function name:  list_values
number of ops:  49
compiled vars:  !0 = $array, !1 = $output, !2 = $k1, !3 = $v1, !4 = $v2, !5 = $k2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   RECV                                             !0      
   27     1        ASSIGN                                                   !1, <array>
   28     2        INIT_FCALL                                               'array_keys'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $7      
          5        FETCH_DIM_R                                      ~8      $7, 0
          6        ASSIGN                                                   !2, ~8
   29     7        COUNT                                            ~10     !0
          8        IS_EQUAL                                                 ~10, 1
          9      > JMPZ                                                     ~11, ->21
   30    10    >   FETCH_DIM_R                                      ~12     !0, !2
         11      > FE_RESET_R                                       $13     ~12, ->19
         12    > > FE_FETCH_R                                               $13, !3, ->19
   31    13    >   ROPE_INIT                                     3  ~16     !2
         14        ROPE_ADD                                      1  ~16     ~16, '%3A'
         15        ROPE_END                                      2  ~15     ~16, !3
         16        ASSIGN_DIM                                               !1
         17        OP_DATA                                                  ~15
   30    18      > JMP                                                      ->12
         19    >   FE_FREE                                                  $13
   29    20      > JMP                                                      ->47
   35    21    >   FETCH_DIM_R                                      ~18     !0, !2
         22      > FE_RESET_R                                       $19     ~18, ->46
         23    > > FE_FETCH_R                                               $19, !3, ->46
   36    24    >   INIT_FCALL_BY_NAME                                       'list_values'
         25        INIT_FCALL                                               'array_slice'
         26        SEND_VAR                                                 !0
         27        SEND_VAL                                                 1
         28        SEND_VAL                                                 null
         29        SEND_VAL                                                 <true>
         30        DO_ICALL                                         $20     
         31        SEND_VAR_NO_REF_EX                                       $20
         32        DO_FCALL                                      0  $21     
         33      > FE_RESET_R                                       $22     $21, ->44
         34    > > FE_FETCH_R                                       ~23     $22, !4, ->44
         35    >   ASSIGN                                                   !5, ~23
   37    36        ROPE_INIT                                     5  ~27     !2
         37        ROPE_ADD                                      1  ~27     ~27, '%3A'
         38        ROPE_ADD                                      2  ~27     ~27, !3
         39        ROPE_ADD                                      3  ~27     ~27, '%3B'
         40        ROPE_END                                      4  ~26     ~27, !4
         41        ASSIGN_DIM                                               !1
         42        OP_DATA                                                  ~26
   36    43      > JMP                                                      ->34
         44    >   FE_FREE                                                  $22
   35    45      > JMP                                                      ->23
         46    >   FE_FREE                                                  $19
   41    47    > > RETURN                                                   !1
   42    48*     > RETURN                                                   null

End of function list_values

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
138.51 ms | 1007 KiB | 17 Q