3v4l.org

run code in 300+ PHP versions simultaneously
<?php function unsetMultidimensional(&$array, $keys) { $key = array_shift($keys); echo $key."\n"; if(isset($array[$key])) { if(count($keys) === 0) { //Logger::info('Key is successfully removed'); unset($array[$key]); } else if(is_array($array[$key])) { unsetMultidimensional($array[$key], $keys); } else { //Logger::error('Key doesn\'t exist'): $array = false; } } } $array = array( 'foo' => 'bar' ); $keys = explode('/', 'foo'); var_dump($keys); var_dump(unsetMultidimensional($array, $keys));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/VbmiP
function name:  (null)
number of ops:  17
compiled vars:  !0 = $array, !1 = $keys
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   ASSIGN                                                   !0, <array>
   23     1        INIT_FCALL                                               'explode'
          2        SEND_VAL                                                 '%2F'
          3        SEND_VAL                                                 'foo'
          4        DO_ICALL                                         $3      
          5        ASSIGN                                                   !1, $3
   25     6        INIT_FCALL                                               'var_dump'
          7        SEND_VAR                                                 !1
          8        DO_ICALL                                                 
   26     9        INIT_FCALL                                               'var_dump'
         10        INIT_FCALL                                               'unsetmultidimensional'
         11        SEND_REF                                                 !0
         12        SEND_VAR                                                 !1
         13        DO_FCALL                                      0  $6      
         14        SEND_VAR                                                 $6
         15        DO_ICALL                                                 
         16      > RETURN                                                   1

Function unsetmultidimensional:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 26
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 15
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 25
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 26
filename:       /in/VbmiP
function name:  unsetMultidimensional
number of ops:  27
compiled vars:  !0 = $array, !1 = $keys, !2 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    4     2        INIT_FCALL                                               'array_shift'
          3        SEND_REF                                                 !1
          4        DO_ICALL                                         $3      
          5        ASSIGN                                                   !2, $3
    5     6        CONCAT                                           ~5      !2, '%0A'
          7        ECHO                                                     ~5
    7     8        ISSET_ISEMPTY_DIM_OBJ                         0          !0, !2
          9      > JMPZ                                                     ~6, ->26
    8    10    >   COUNT                                            ~7      !1
         11        IS_IDENTICAL                                             ~7, 0
         12      > JMPZ                                                     ~8, ->15
   10    13    >   UNSET_DIM                                                !0, !2
         14      > JMP                                                      ->26
   11    15    >   FETCH_DIM_R                                      ~9      !0, !2
         16        TYPE_CHECK                                  128          ~9
         17      > JMPZ                                                     ~10, ->25
   12    18    >   INIT_FCALL_BY_NAME                                       'unsetMultidimensional'
         19        CHECK_FUNC_ARG                                           
         20        FETCH_DIM_FUNC_ARG                               $11     !0, !2
         21        SEND_FUNC_ARG                                            $11
         22        SEND_VAR_EX                                              !1
         23        DO_FCALL                                      0          
         24      > JMP                                                      ->26
   15    25    >   ASSIGN                                                   !0, <false>
   18    26    > > RETURN                                                   null

End of function unsetmultidimensional

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.82 ms | 1403 KiB | 20 Q