3v4l.org

run code in 300+ PHP versions simultaneously
<?php $in = array(); // Array with incoming params $res = array();// Array where we will write result $t = &$res; // Link to first level foreach ($in as $k) { // Walk through source array if (empty($t[$k])) { // Check if current level has required key $t[$k] = array(); // If does not, create empty array there $t = &$t[$k]; // And link to it now. So each time it is link to deepest level. } } unset($t); // Drop link to last (most deep) level var_dump($res);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 12
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 12
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 11
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 11
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
filename:       /in/BJpf2
function name:  (null)
number of ops:  18
compiled vars:  !0 = $in, !1 = $res, !2 = $t, !3 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    3     1        ASSIGN                                                   !1, <array>
    4     2        ASSIGN_REF                                               !2, !1
    5     3      > FE_RESET_R                                       $7      !0, ->12
          4    > > FE_FETCH_R                                               $7, !3, ->12
    6     5    >   ISSET_ISEMPTY_DIM_OBJ                         1          !2, !3
          6      > JMPZ                                                     ~8, ->11
    7     7    >   ASSIGN_DIM                                               !2, !3
          8        OP_DATA                                                  <array>
    8     9        FETCH_DIM_W                                      $10     !2, !3
         10        ASSIGN_REF                                               !2, $10
    5    11    > > JMP                                                      ->4
         12    >   FE_FREE                                                  $7
   11    13        UNSET_CV                                                 !2
   12    14        INIT_FCALL                                               'var_dump'
         15        SEND_VAR                                                 !1
         16        DO_ICALL                                                 
         17      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
171.63 ms | 1395 KiB | 15 Q