3v4l.org

run code in 500+ PHP versions simultaneously
<?php $arr = ['level', 'sub', 'item']; $arr = array_reverse($arr); $new =[]; foreach($arr as $key => $item){ if($key ==0){ $new = [$item => []]; }else{ $new = [$item => $new]; } } $other = array ( 'level' => array ( 'sub' => array ( 'AnotherItem' => array ( ), ), ), ); $new = array_merge_recursive($new, $other); var_export($new);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 17
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 17
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 14
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
filename:       /in/VWBpM
function name:  (null)
number of ops:  28
compiled vars:  !0 = $arr, !1 = $new, !2 = $item, !3 = $key, !4 = $other
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
    4     1        INIT_FCALL                                                   'array_reverse'
          2        SEND_VAR                                                     !0
          3        DO_ICALL                                             $6      
          4        ASSIGN                                                       !0, $6
    5     5        ASSIGN                                                       !1, <array>
    6     6      > FE_RESET_R                                           $9      !0, ->17
          7    > > FE_FETCH_R                                           ~10     $9, !2, ->17
          8    >   ASSIGN                                                       !3, ~10
    7     9        IS_EQUAL                                                     !3, 0
         10      > JMPZ                                                         ~12, ->14
    8    11    >   INIT_ARRAY                                           ~13     <array>, !2
         12        ASSIGN                                                       !1, ~13
    7    13      > JMP                                                          ->16
   10    14    >   INIT_ARRAY                                           ~15     !1, !2
         15        ASSIGN                                                       !1, ~15
    6    16    > > JMP                                                          ->7
         17    >   FE_FREE                                                      $9
   13    18        ASSIGN                                                       !4, <array>
   25    19        INIT_FCALL                                                   'array_merge_recursive'
         20        SEND_VAR                                                     !1
         21        SEND_VAR                                                     !4
         22        DO_ICALL                                             $18     
         23        ASSIGN                                                       !1, $18
   27    24        INIT_FCALL                                                   'var_export'
         25        SEND_VAR                                                     !1
         26        DO_ICALL                                                     
         27      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
159.97 ms | 2245 KiB | 16 Q