3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = array(); $arrayKey = '[0][1]'; $a[0][1] = "two levels deep"; function get( $string, $vars ) { $keys = explode( '][', substr( $string, 1, -1 ) ); foreach( $keys as $key ) { $vars = $vars[$key]; } return $vars; } echo get($arrayKey, $vars );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/uQoMp
function name:  (null)
number of ops:  11
compiled vars:  !0 = $a, !1 = $arrayKey, !2 = $vars
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, '%5B0%5D%5B1%5D'
    6     2        FETCH_DIM_W                                      $5      !0, 0
          3        ASSIGN_DIM                                               $5, 1
          4        OP_DATA                                                  'two+levels+deep'
   17     5        INIT_FCALL                                               'get'
          6        SEND_VAR                                                 !1
          7        SEND_VAR                                                 !2
          8        DO_FCALL                                      0  $7      
          9        ECHO                                                     $7
         10      > RETURN                                                   1

Function get:
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/uQoMp
function name:  get
number of ops:  20
compiled vars:  !0 = $string, !1 = $vars, !2 = $keys, !3 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   10     2        INIT_FCALL                                               'explode'
          3        SEND_VAL                                                 '%5D%5B'
          4        INIT_FCALL                                               'substr'
          5        SEND_VAR                                                 !0
          6        SEND_VAL                                                 1
          7        SEND_VAL                                                 -1
          8        DO_ICALL                                         $4      
          9        SEND_VAR                                                 $4
         10        DO_ICALL                                         $5      
         11        ASSIGN                                                   !2, $5
   11    12      > FE_RESET_R                                       $7      !2, ->17
         13    > > FE_FETCH_R                                               $7, !3, ->17
   12    14    >   FETCH_DIM_R                                      ~8      !1, !3
         15        ASSIGN                                                   !1, ~8
   11    16      > JMP                                                      ->13
         17    >   FE_FREE                                                  $7
   14    18      > RETURN                                                   !1
   15    19*     > RETURN                                                   null

End of function get

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.14 ms | 943 KiB | 19 Q