3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function setKey($sessionKeys, $value) { $sessionKeysArray = explode(':', $sessionKeys); $sessionKey = ''; foreach ($sessionKeysArray as $key){ $sessionKey .= "[\'$key\']"; } echo eval('&$_SESSION' . $sessionKey . ' = ' . $value . ';'); var_dump($_SESSION); } setKey('1:2:3', 77);
based on CT9Cj
Finding entry points
Branch analysis from position: 0
Jump found. (Code = 62) Position 1 = -2
filename:       /in/D5uhq
function name:  (null)
number of ops:  6
compiled vars:  none
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   3     0  E >   NOP                                                      
  17     1        INIT_FCALL                                               'setkey'
         2        SEND_VAL                                                 '1%3A2%3A3'
         3        SEND_VAL                                                 77
         4        DO_FCALL                                      0          
         5      > RETURN                                                   1

Function setkey:
Finding entry points
Branch analysis from position: 0
Jump found. (Code = 77) Position 1 = 9, Position 2 = 15
Branch analysis from position: 9
Jump found. (Code = 78) Position 1 = 10, Position 2 = 15
Branch analysis from position: 10
Jump found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 15
Jump found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
filename:       /in/D5uhq
function name:  setKey
number of ops:  27
compiled vars:  !0 = $sessionKeys, !1 = $value, !2 = $sessionKeysArray, !3 = $sessionKey, !4 = $key
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   3     0  E >   RECV                                             !0      
         1        RECV                                             !1      
   5     2        INIT_FCALL                                               'explode'
         3        SEND_VAL                                                 '%3A'
         4        SEND_VAR                                                 !0
         5        DO_ICALL                                         $5      
         6        ASSIGN                                                   !2, $5
   6     7        ASSIGN                                                   !3, ''
   7     8      > FE_RESET_R                                       $8      !2, ->15
         9    > > FE_FETCH_R                                               $8, !4, ->15
   8    10    >   ROPE_INIT                                     3  ~10     '%5B%5C%27'
        11        ROPE_ADD                                      1  ~10     ~10, !4
        12        ROPE_END                                      2  ~9      ~10, '%5C%27%5D'
        13        ASSIGN_CONCAT                                 0          !3, ~9
        14      > JMP                                                      ->9
        15    >   FE_FREE                                                  $8
  11    16        CONCAT                                           ~13     '%26%24_SESSION', !3
        17        CONCAT                                           ~14     ~13, '+%3D+'
        18        CONCAT                                           ~15     ~14, !1
        19        CONCAT                                           ~16     ~15, '%3B'
        20        INCLUDE_OR_EVAL                                  $17     ~16, EVAL
        21        ECHO                                                     $17
  12    22        INIT_FCALL                                               'var_dump'
        23        FETCH_R                      global              $18     '_SESSION'
        24        SEND_VAR                                                 $18
        25        DO_ICALL                                                 
  15    26      > RETURN                                                   null

End of function setkey

Generated using Vulcan Logic Dumper, using php 7.3.0