3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait SupportSystemConfiguration { protected $_supportSystemConfiguration; public function getConfig() : Config { return $this->_supportSystemConfiguration; } public function setConfig( Config $supportSystemConfiguration ) : void { $this->_supportSystemConfiguration = $supportSystemConfiguration; } } class Config { public $dbName; public function __construct(string $dbName) { $this->dbName = $dbName; } } class Foo { use SupportSystemConfiguration; public function __construct(Config $supportSystemConfig) { $this->setConfig( $supportSystemConfig ); } public function displayCheck() : void {} } class Baz { use SupportSystemConfiguration; public function __construct(Config $supportSystemConfig ) { $this->setConfig( $supportSystemConfig ); } public function performCheck() : string { $objFoo = new Foo( $this->getConfig() ); $objFoo->displayCheck(); return 'ok'; } } $objSupportSystemConfiguration = new Config('abc'); $objFuzz = new Baz( $objSupportSystemConfiguration ); echo $objFuzz->performCheck();
Output for git.master, git.master_jit, rfc.property-hooks
ok

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