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

Shows result from various feature-branches currently under review from the php developers. Contact me to have additional branches featured.

Output for Typed properties v2
Parse error: syntax error, unexpected '&', expecting end of file in /in/D5uhq(11) : eval()'d code on line 1
Output for Arrow functions
Parse error: syntax error, unexpected '&', expecting end of file in /in/D5uhq(11) : eval()'d code on line 1
Output for Object typehint
Parse error: syntax error, unexpected '&', expecting end of file in /in/D5uhq(11) : eval()'d code on line 1
Output for Array change keys
Parse error: syntax error, unexpected '&', expecting end of file in /in/D5uhq(11) : eval()'d code on line 1
Output for Lexical anon
Parse error: syntax error, unexpected '&', expecting end of file in /in/D5uhq(11) : eval()'d code on line 1 Notice: Undefined variable: _SESSION in /in/D5uhq on line 12 NULL

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page