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\']"; } eval('$tmp = &$_SESSION' . $sessionKey . ' = ' . $value . ';'); var_dump($tmp); } setKey('1:2:3', 77);
based on BKE0N
Output for 7.0.0 - 7.2.0
Parse error: syntax error, unexpected ''1\'][\'2\'][\'3\'] = 77;' (T_ENCAPSED_AND_WHITESPACE), expecting identifier (T_STRING) in /in/hmFGF(11) : eval()'d code on line 1
Process exited with code 255.
Output for 5.4.11 - 5.6.28
Parse error: syntax error, unexpected ''1\'][\'2\'][\'3\'] = 77;' (T_ENCAPSED_AND_WHITESPACE), expecting identifier (T_STRING) in /in/hmFGF(11) : eval()'d code on line 1 Notice: Undefined variable: tmp in /in/hmFGF on line 13 NULL
Output for 5.3.21 - 5.3.29
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING in /in/hmFGF(11) : eval()'d code on line 1 Notice: Undefined variable: tmp in /in/hmFGF on line 13 NULL
Process exited with code 255.