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"); $_SESSION{$sessionKey} = $value; var_dump($_SESSION); return !empty(self::getKey($sessionKey)); } setKey('1:2:3', 77);
based on iCWVe
Output for 7.0.0 - 7.0.2
Fatal error: Cannot use "self" when no class scope is active in /in/2ifZp on line 15
Process exited with code 255.
Output for 5.5.24 - 5.6.17
Notice: Undefined variable: _SESSION in /in/2ifZp on line 10 Parse error: syntax error, unexpected '&' in /in/2ifZp(10) : eval()'d code on line 1 array(1) { ["[\'1\'][\'2\'][\'3\']"]=> int(77) } Fatal error: Cannot access self:: when no class scope is active in /in/2ifZp on line 15
Process exited with code 255.
Output for 5.3.21 - 5.4.45
Fatal error: Can't use function return value in write context in /in/2ifZp on line 15
Process exited with code 255.