3v4l.org

run code in 300+ PHP versions simultaneously
<?php $in = array(); for($i = 1; $i <=5; $i++) { $in[] = $i; } $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
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
2 jumps found. (Code = 44) Position 1 = 9, Position 2 = 3
Branch analysis from position: 9
2 jumps found. (Code = 77) Position 1 = 12, Position 2 = 20
Branch analysis from position: 12
2 jumps found. (Code = 78) Position 1 = 13, Position 2 = 20
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 19
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
Branch analysis from position: 19
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
Branch analysis from position: 3
2 jumps found. (Code = 44) Position 1 = 9, Position 2 = 3
Branch analysis from position: 9
Branch analysis from position: 3
filename:       /in/9CACh
function name:  (null)
number of ops:  26
compiled vars:  !0 = $in, !1 = $i, !2 = $res, !3 = $t, !4 = $k
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   2     0  E >   ASSIGN                                                   !0, <array>
   4     1        ASSIGN                                                   !1, 1
         2      > JMP                                                      ->7
   6     3    >   ASSIGN_DIM                                               !0
         4        OP_DATA                                                  !1
   4     5        POST_INC                                         ~8      !1
         6        FREE                                                     ~8
         7    >   CAST                                          0  ~9      !1, 5
         8      > JMPNZ                                                    ~9, ->3
   8     9    >   ASSIGN                                                   !2, <array>
   9    10        ASSIGN_REF                                               !3, !2
  10    11      > FE_RESET_R                                       $12     !0, ->20
        12    > > FE_FETCH_R                                               $12, !4, ->20
  11    13    >   ISSET_ISEMPTY_DIM_OBJ                         1  ~13     !3, !4
        14      > JMPZ                                                     ~13, ->19
  12    15    >   ASSIGN_DIM                                               !3, !4
        16        OP_DATA                                                  <array>
  13    17        FETCH_DIM_W                                      $15     !3, !4
        18        ASSIGN_REF                                               !3, $15
  10    19    > > JMP                                                      ->12
        20    >   FE_FREE                                                  $12
  16    21        UNSET_CV                                                 !3
  17    22        INIT_FCALL                                               'var_dump'
        23        SEND_VAR                                                 !2
        24        DO_ICALL                                                 
        25      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.43 ms | 462 KiB | 7 Q