3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function setKey($sessionKeys, $value) { $sessionKeysArray = explode(':', $sessionKeys); $sessionKey = ''; $keys = '[\'' . implode('\'][\'', $sessionKeysArray) . '\']'; eval('$tmp = is_array(&$_SESSION' . $sessionKey . ') ? ' . $value . ' : \'xxx\';'); var_dump($tmp); } $_SESSION['1']['2']['3'] = 'zzzz'; setKey('1:2:3', 77);
based on ISKcr
Output for 7.0.0 - 7.2.0
Parse error: syntax error, unexpected '&' in /in/v2q6p(9) : eval()'d code on line 1
Process exited with code 255.
Output for 5.4.11 - 5.6.28
Fatal error: Call-time pass-by-reference has been removed in /in/v2q6p(9) : eval()'d code on line 1
Process exited with code 255.
Output for 5.3.21 - 5.3.29
Deprecated: Call-time pass-by-reference has been deprecated in /in/v2q6p(9) : eval()'d code on line 1 int(77)