3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * Created by Code Cleanup Team * @author aldo.suwandi@aurea.com */ class GlobalConfig { private static $config; public static function setConfig($key, $value) { static::$config[$key] = $value; } public static function getConfig($key) { if (isset($GLOBALS[$key])) { return $GLOBALS[$key]; //temporary until refactoring finished //NOSONAR } else { if (!isset(static::$config[$key])) { return null; } else { return self::$config[$key]; } } } public static function unsetConfig($key) { unset(self::$config[$key]); } } $key = 'var1'; // for simple values $description = 456; GlobalConfig::setConfig($key, $description); $var1 = GlobalConfig::getConfig($key); var_dump($var1); // for objects $description = new stdClass(); GlobalConfig::setConfig($key, $description); $var1 = GlobalConfig::getConfig($key); var_dump($var1); // for array $description = array('str 111222333','str 333444555'); GlobalConfig::setConfig($key, $description); $var1 = GlobalConfig::getConfig($key); var_dump($var1);
Output for git.master, git.master_jit, rfc.property-hooks
int(456) int(456) int(456)

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

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


preferences:
61.58 ms | 401 KiB | 8 Q