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 7thKU
Output for 7.2.0
Warning: Use of undefined constant zzzz - assumed 'zzzz' (this will throw an Error in a future version of PHP) in /in/ISKcr on line 15 Parse error: syntax error, unexpected '&' in /in/ISKcr(9) : eval()'d code on line 1
Process exited with code 255.
Output for 7.0.0 - 7.1.10
Notice: Use of undefined constant zzzz - assumed 'zzzz' in /in/ISKcr on line 15 Parse error: syntax error, unexpected '&' in /in/ISKcr(9) : eval()'d code on line 1
Process exited with code 255.
Output for 5.4.11 - 5.6.28
Notice: Use of undefined constant zzzz - assumed 'zzzz' in /in/ISKcr on line 15 Fatal error: Call-time pass-by-reference has been removed in /in/ISKcr(9) : eval()'d code on line 1
Process exited with code 255.
Output for 5.3.21 - 5.3.29
Notice: Use of undefined constant zzzz - assumed 'zzzz' in /in/ISKcr on line 15 Deprecated: Call-time pass-by-reference has been deprecated in /in/ISKcr(9) : eval()'d code on line 1 int(77)