3v4l.org

run code in 300+ PHP versions simultaneously
<?php $i_have_this = [ "Base/child" => [ [ "filename" => "child-1", "last_modified" => "29/01/2020" ], [ "filename" => "child-2", "last_modified" => "29/01/2020" ], [ "filename" => "child-3", "last_modified" => "29/01/2020" ] ], "Base/child/grandChild1" => [ [ "filename" => "grandChild1-1", "last_modified" => "29/01/2020" ] ], "Base/child/grandChild2" => [ [ "filename" => "grandChild2-1", "last_modified" => "29/01/2020" ], [ "filename" => "grandChild2-2", "last_modified" => "29/01/2020" ], [ "filename" => "grandChild2-3", "last_modified" => "29/01/2020" ], [ "filename" => "grandChild2-4", "last_modified" => "29/01/2020" ], [ "filename" => "grandChild2-5", "last_modified" => "29/01/2020" ] ] ]; $want_this = []; foreach($i_have_this as $path => $value) { $temp = &$want_this; foreach (explode('/', $path) as $key) { $temp = &$temp[$key]; } $temp = $value; } print_r($want_this);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 18
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 18
Branch analysis from position: 4
2 jumps found. (Code = 77) Position 1 = 11, Position 2 = 15
Branch analysis from position: 11
2 jumps found. (Code = 78) Position 1 = 12, Position 2 = 15
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 15
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
filename:       /in/gM0vA
function name:  (null)
number of ops:  23
compiled vars:  !0 = $i_have_this, !1 = $want_this, !2 = $value, !3 = $path, !4 = $temp, !5 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   48     1        ASSIGN                                                   !1, <array>
   49     2      > FE_RESET_R                                       $8      !0, ->18
          3    > > FE_FETCH_R                                       ~9      $8, !2, ->18
          4    >   ASSIGN                                                   !3, ~9
   50     5        ASSIGN_REF                                               !4, !1
   52     6        INIT_FCALL                                               'explode'
          7        SEND_VAL                                                 '%2F'
          8        SEND_VAR                                                 !3
          9        DO_ICALL                                         $12     
         10      > FE_RESET_R                                       $13     $12, ->15
         11    > > FE_FETCH_R                                               $13, !5, ->15
   53    12    >   FETCH_DIM_W                                      $14     !4, !5
         13        ASSIGN_REF                                               !4, $14
   52    14      > JMP                                                      ->11
         15    >   FE_FREE                                                  $13
   55    16        ASSIGN                                                   !4, !2
   49    17      > JMP                                                      ->3
         18    >   FE_FREE                                                  $8
   59    19        INIT_FCALL                                               'print_r'
         20        SEND_VAR                                                 !1
         21        DO_ICALL                                                 
         22      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
170.23 ms | 1400 KiB | 17 Q