3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace DummyTest\Lib { class TObject { public function __construct() { } } class TComponent extends \DummyTest\Lib\TObject { public function __construct() { parent::__construct(); } } class TSingletonComponent extends \DummyTest\Lib\TComponent { public function __construct() { parent::__construct(); } } class TDatabase extends \DummyTest\Lib\TSingletonComponent { public function __construct() { parent::__construct(); } public static function Init() { $db = new \DummyTest\Lib\Database\TPDO(); } } } namespace DummyTest\Lib\Database { class TDatabase extends \DummyTest\Lib\TComponent { public function __construct() { parent::__construct(); } } class TPDO extends \DummyTest\Lib\Database\TDatabase { protected $pdo; public function __construct() { parent::__construct(); echo serialize(\DummyTest\SystemConfig::Get('xxx')); // Fails in PHP } } } namespace DummyTest { class SystemConfig { protected static $config = array(); public function Get($name) { echo get_called_class().PHP_EOL; if(isset(static::$config[$name])) { return static::$config[$name]; } return null; } public function Set($name, $value) { static::$config[$name] = $value; } } SystemConfig::Set('xxx', 'yyy'); \DummyTest\Lib\TDatabase::Init(); }
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught Error: Non-static method DummyTest\SystemConfig::Set() cannot be called statically in /in/1r5Um:61 Stack trace: #0 {main} thrown in /in/1r5Um on line 61
Process exited with code 255.

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