3v4l.org

run code in 300+ PHP versions simultaneously
<?php abstract class EventManagerBase { abstract protected function attach(string $event); } final class EventManager extends EventManagerBase { protected function attach(string $event) { echo "attaching $event\n"; } } final class EventConfigurator extends EventManagerBase { private EventManagerBase $eventManager; public function __construct(EventManagerBase $eventManager, array $config) { $this->eventManager = $eventManager; foreach ($config as $event) { $this->attach($event); } } protected function attach(string $event) { $this->eventManager->attach($event); } } $eventManager = new EventManager(); $configurator = new EventConfigurator($eventManager, ['event1', 'event2']);
Output for git.master, git.master_jit, rfc.property-hooks
attaching event1 attaching event2

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