3v4l.org

run code in 500+ PHP versions simultaneously
<?php $path = "['parent']['son']"; $_SESSION['parent']['son'] = "test"; $arr = explode("']['", $path); $ret = $_SESSION; foreach($arr as $val){ $key = str_replace(["'", "]", "["], "", $val); $ret = $ret[$key]; } Var_dump($ret);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 13, Position 2 = 20
Branch analysis from position: 13
2 jumps found. (Code = 78) Position 1 = 14, Position 2 = 20
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
filename:       /in/KgYOA
function name:  (null)
number of ops:  25
compiled vars:  !0 = $path, !1 = $arr, !2 = $ret, !3 = $val, !4 = $key
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, '%5B%27parent%27%5D%5B%27son%27%5D'
    4     1        FETCH_W                          global              $6      '_SESSION'
          2        FETCH_DIM_W                                          $7      $6, 'parent'
          3        ASSIGN_DIM                                                   $7, 'son'
          4        OP_DATA                                                      'test'
    6     5        INIT_FCALL                                                   'explode'
          6        SEND_VAL                                                     '%27%5D%5B%27'
          7        SEND_VAR                                                     !0
          8        DO_ICALL                                             $9      
          9        ASSIGN                                                       !1, $9
    8    10        FETCH_R                          global              ~11     '_SESSION'
         11        ASSIGN                                                       !2, ~11
   10    12      > FE_RESET_R                                           $13     !1, ->20
         13    > > FE_FETCH_R                                                   $13, !3, ->20
   11    14    >   FRAMELESS_ICALL_3                str_replace         ~14     <array>, ''
         15        OP_DATA                                                      !3
         16        ASSIGN                                                       !4, ~14
   12    17        FETCH_DIM_R                                          ~16     !2, !4
         18        ASSIGN                                                       !2, ~16
   10    19      > JMP                                                          ->13
         20    >   FE_FREE                                                      $13
   15    21        INIT_FCALL                                                   'var_dump'
         22        SEND_VAR                                                     !2
         23        DO_ICALL                                                     
         24      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
128.58 ms | 478 KiB | 9 Q