3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ 'key' => [ 'key_2' => [ 'key_3' => 'Value 3' ] ], ]; function get_value($array, $key ) { $keys = explode(",", str_replace(["[","]"], [",",""],$key)); Foreach($keys as $k){ $array = $array[$k]; } Return $array; } Var_dump(get_value($array, 'key[key_2][key_3]' ));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BObTk
function name:  (null)
number of ops:  9
compiled vars:  !0 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   19     1        INIT_FCALL                                               'var_dump'
          2        INIT_FCALL                                               'get_value'
          3        SEND_VAR                                                 !0
          4        SEND_VAL                                                 'key%5Bkey_2%5D%5Bkey_3%5D'
          5        DO_FCALL                                      0  $2      
          6        SEND_VAR                                                 $2
          7        DO_ICALL                                                 
          8      > RETURN                                                   1

Function get_value:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 13, Position 2 = 17
Branch analysis from position: 13
2 jumps found. (Code = 78) Position 1 = 14, Position 2 = 17
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
filename:       /in/BObTk
function name:  get_value
number of ops:  20
compiled vars:  !0 = $array, !1 = $key, !2 = $keys, !3 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   12     2        INIT_FCALL                                               'explode'
          3        SEND_VAL                                                 '%2C'
          4        INIT_FCALL                                               'str_replace'
          5        SEND_VAL                                                 <array>
          6        SEND_VAL                                                 <array>
          7        SEND_VAR                                                 !1
          8        DO_ICALL                                         $4      
          9        SEND_VAR                                                 $4
         10        DO_ICALL                                         $5      
         11        ASSIGN                                                   !2, $5
   13    12      > FE_RESET_R                                       $7      !2, ->17
         13    > > FE_FETCH_R                                               $7, !3, ->17
   14    14    >   FETCH_DIM_R                                      ~8      !0, !3
         15        ASSIGN                                                   !0, ~8
   13    16      > JMP                                                      ->13
         17    >   FE_FREE                                                  $7
   16    18      > RETURN                                                   !0
   17    19*     > RETURN                                                   null

End of function get_value

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.84 ms | 1016 KiB | 17 Q