3v4l.org

run code in 300+ PHP versions simultaneously
<?php class ConfigManager { var $config = array(); function ConfigManager() { echo "Created\n"; } function load() { $this->config = array('foo' => 'bar'); } function get($key) { return isset($this->config[$key]) ? $this->config[$key] : null; } function set($key, $value) { $this->config[$key] = $value; } } function &config_get_manager() { static $configManager = null; if (!isset($configManager)) { $configManager = new ConfigManager; $configManager->load(); } return $configManager; } function config_get($key) { static $configManager = null; if (!isset($configManager)) { $configManager = &config_get_manager(); } return $configManager->get($key); } function config_set($key, $value) { static $configManager = null; if (!isset($configManager)) { $configManager = &config_get_manager(); } $configManager->set($key, $value); } echo config_get('foo') . "\n"; config_set('foo', 'baz'); echo config_get('foo') . "\n";
Output for git.master, git.master_jit, rfc.property-hooks
bar baz

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:
39.47 ms | 401 KiB | 8 Q