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
Output for 7.0.0 - 7.2.0
Parse error: syntax error, unexpected '&', expecting end of file in /in/D5uhq(11) : eval()'d code on line 1
Process exited with code 255.
Output for hhvm-3.10.1 - 3.11.1, hhvm-3.13.2 - 3.17.3
Fatal error: syntax error, unexpected '&', expecting $end in /in/D5uhq(11)(c2e9fb897e2077172934118a90ae35f3) : eval()'d code on line 1 array(0) { }
Output for hhvm-3.12.14

Process exited with code 137.
Output for 5.5.0 - 5.6.30
Parse error: syntax error, unexpected '&' in /in/D5uhq(11) : eval()'d code on line 1 Notice: Undefined variable: _SESSION in /in/D5uhq on line 12 NULL