3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [['instances' => [1,2]], ['instances' => [3,4]]]; print_r($array); $flatPath = '0/instances/0'; $keys = explode('/', $flatPath); $endKey = array_pop($keys); $arr = &$array; foreach ($keys as $key) { $arr = &$arr[$key]; } unset($arr[$endKey]); unset($arr); print_r($array);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 16, Position 2 = 20
Branch analysis from position: 16
2 jumps found. (Code = 78) Position 1 = 17, Position 2 = 20
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
filename:       /in/RoPpl
function name:  (null)
number of ops:  27
compiled vars:  !0 = $array, !1 = $flatPath, !2 = $keys, !3 = $endKey, !4 = $arr, !5 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    4     1        INIT_FCALL                                               'print_r'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                                 
    6     4        ASSIGN                                                   !1, '0%2Finstances%2F0'
    7     5        INIT_FCALL                                               'explode'
          6        SEND_VAL                                                 '%2F'
          7        SEND_VAR                                                 !1
          8        DO_ICALL                                         $9      
          9        ASSIGN                                                   !2, $9
    8    10        INIT_FCALL                                               'array_pop'
         11        SEND_REF                                                 !2
         12        DO_ICALL                                         $11     
         13        ASSIGN                                                   !3, $11
    9    14        ASSIGN_REF                                               !4, !0
   10    15      > FE_RESET_R                                       $14     !2, ->20
         16    > > FE_FETCH_R                                               $14, !5, ->20
   11    17    >   FETCH_DIM_W                                      $15     !4, !5
         18        ASSIGN_REF                                               !4, $15
   10    19      > JMP                                                      ->16
         20    >   FE_FREE                                                  $14
   13    21        UNSET_DIM                                                !4, !3
   14    22        UNSET_CV                                                 !4
   16    23        INIT_FCALL                                               'print_r'
         24        SEND_VAR                                                 !0
         25        DO_ICALL                                                 
         26      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
199.98 ms | 1004 KiB | 16 Q