3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arg1 = "['1']"; $arg2 = "['2']"; $arg3 = "['3']"; $_SESSION['1']['2']['3'] = 'zzzz'; function setKey($session_keys, $val) { $current_key = ''; $counter = 0; $prev_step = &$_SESSION; $tmp = &$prev_step; $session_keys_array = explode(':', $session_keys); foreach ($session_keys_array as $key) { if (is_array($tmp[$key])) { $tmp = &$tmp[$key]; var_dump($tmp); } else { $tmp = $val; var_dump($tmp); } } } setKey('1:2:3',5); // var_dump($_SESSION);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/o7jqn
function name:  (null)
number of ops:  13
compiled vars:  !0 = $arg1, !1 = $arg2, !2 = $arg3
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%5B%271%27%5D'
    4     1        ASSIGN                                                   !1, '%5B%272%27%5D'
    5     2        ASSIGN                                                   !2, '%5B%273%27%5D'
    7     3        FETCH_W                      global              $6      '_SESSION'
          4        FETCH_DIM_W                                      $7      $6, 1
          5        FETCH_DIM_W                                      $8      $7, 2
          6        ASSIGN_DIM                                               $8, 3
          7        OP_DATA                                                  'zzzz'
   27     8        INIT_FCALL                                               'setkey'
          9        SEND_VAL                                                 '1%3A2%3A3'
         10        SEND_VAL                                                 5
         11        DO_FCALL                                      0          
   29    12      > RETURN                                                   1

Function setkey:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 13, Position 2 = 28
Branch analysis from position: 13
2 jumps found. (Code = 78) Position 1 = 14, Position 2 = 28
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 23
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 27
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 28
filename:       /in/o7jqn
function name:  setKey
number of ops:  30
compiled vars:  !0 = $session_keys, !1 = $val, !2 = $current_key, !3 = $counter, !4 = $prev_step, !5 = $tmp, !6 = $session_keys_array, !7 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   10     2        ASSIGN                                                   !2, ''
   11     3        ASSIGN                                                   !3, 0
   12     4        FETCH_W                      global              $10     '_SESSION'
          5        ASSIGN_REF                                               !4, $10
   13     6        ASSIGN_REF                                               !5, !4
   14     7        INIT_FCALL                                               'explode'
          8        SEND_VAL                                                 '%3A'
          9        SEND_VAR                                                 !0
         10        DO_ICALL                                         $13     
         11        ASSIGN                                                   !6, $13
   16    12      > FE_RESET_R                                       $15     !6, ->28
         13    > > FE_FETCH_R                                               $15, !7, ->28
   17    14    >   FETCH_DIM_R                                      ~16     !5, !7
         15        TYPE_CHECK                                  128          ~16
         16      > JMPZ                                                     ~17, ->23
   18    17    >   FETCH_DIM_W                                      $18     !5, !7
         18        ASSIGN_REF                                               !5, $18
   19    19        INIT_FCALL                                               'var_dump'
         20        SEND_VAR                                                 !5
         21        DO_ICALL                                                 
         22      > JMP                                                      ->27
   21    23    >   ASSIGN                                                   !5, !1
   22    24        INIT_FCALL                                               'var_dump'
         25        SEND_VAR                                                 !5
         26        DO_ICALL                                                 
   16    27    > > JMP                                                      ->13
         28    >   FE_FREE                                                  $15
   25    29      > RETURN                                                   null

End of function setkey

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.15 ms | 1414 KiB | 18 Q