3v4l.org

run code in 300+ PHP versions simultaneously
<?php function unsetMultidimensional(&$array, $keys) { $key = array_shift($keys); 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; } } } var_dump(unsetMultidimensional(array( 'foo' => 'bar' ), explode('/', 'foo')));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/LuLmc
function name:  (null)
number of ops:  12
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'unsetmultidimensional'
   19     2        SEND_VAL_EX                                              <array>
   20     3        INIT_FCALL                                               'explode'
          4        SEND_VAL                                                 '%2F'
          5        SEND_VAL                                                 'foo'
          6        DO_ICALL                                         $0      
          7        SEND_VAR                                                 $0
          8        DO_FCALL                                      0  $1      
          9        SEND_VAR                                                 $1
         10        DO_ICALL                                                 
         11      > RETURN                                                   1

Function unsetmultidimensional:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 24
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 13
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 23
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
filename:       /in/LuLmc
function name:  unsetMultidimensional
number of ops:  25
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
    6     6        ISSET_ISEMPTY_DIM_OBJ                         0          !0, !2
          7      > JMPZ                                                     ~5, ->24
    7     8    >   COUNT                                            ~6      !1
          9        IS_IDENTICAL                                             ~6, 0
         10      > JMPZ                                                     ~7, ->13
    9    11    >   UNSET_DIM                                                !0, !2
         12      > JMP                                                      ->24
   10    13    >   FETCH_DIM_R                                      ~8      !0, !2
         14        TYPE_CHECK                                  128          ~8
         15      > JMPZ                                                     ~9, ->23
   11    16    >   INIT_FCALL_BY_NAME                                       'unsetMultidimensional'
         17        CHECK_FUNC_ARG                                           
         18        FETCH_DIM_FUNC_ARG                               $10     !0, !2
         19        SEND_FUNC_ARG                                            $10
         20        SEND_VAR_EX                                              !1
         21        DO_FCALL                                      0          
         22      > JMP                                                      ->24
   14    23    >   ASSIGN                                                   !0, <false>
   17    24    > > RETURN                                                   null

End of function unsetmultidimensional

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.56 ms | 1403 KiB | 20 Q