3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Container { private array $services; public function __construct() { $this->services = [ static fn() => doStuff($this), ]; } } $container = new Container; unset($container); var_dump(gc_status()); class Container2 { private array $services; public function __construct() { $this->services = [ static fn(self $self) => doStuff($self), ]; } public function build() { foreach ($this->services as $service) { $service($this); } } } $container = new Container2; unset($container); var_dump(gc_status());
Output for git.master_jit
Warning: Module "Zend OPcache" is already loaded in Unknown on line 0 Warning: Zend OPcache: module registration failed! in Unknown on line 0 array(12) { ["running"]=> bool(false) ["protected"]=> bool(false) ["full"]=> bool(false) ["runs"]=> int(0) ["collected"]=> int(0) ["threshold"]=> int(10001) ["buffer_size"]=> int(16384) ["roots"]=> int(0) ["application_time"]=> float(0.000637438) ["collector_time"]=> float(0) ["destructor_time"]=> float(0) ["free_time"]=> float(0) } array(12) { ["running"]=> bool(false) ["protected"]=> bool(false) ["full"]=> bool(false) ["runs"]=> int(0) ["collected"]=> int(0) ["threshold"]=> int(10001) ["buffer_size"]=> int(16384) ["roots"]=> int(0) ["application_time"]=> float(0.000747697) ["collector_time"]=> float(0) ["destructor_time"]=> float(0) ["free_time"]=> float(0) }
Output for git.master
Warning: Module "Zend OPcache" is already loaded in Unknown on line 0 Warning: Zend OPcache: module registration failed! in Unknown on line 0 array(12) { ["running"]=> bool(false) ["protected"]=> bool(false) ["full"]=> bool(false) ["runs"]=> int(0) ["collected"]=> int(0) ["threshold"]=> int(10001) ["buffer_size"]=> int(16384) ["roots"]=> int(0) ["application_time"]=> float(0.000489138) ["collector_time"]=> float(0) ["destructor_time"]=> float(0) ["free_time"]=> float(0) } array(12) { ["running"]=> bool(false) ["protected"]=> bool(false) ["full"]=> bool(false) ["runs"]=> int(0) ["collected"]=> int(0) ["threshold"]=> int(10001) ["buffer_size"]=> int(16384) ["roots"]=> int(0) ["application_time"]=> float(0.000608578) ["collector_time"]=> float(0) ["destructor_time"]=> float(0) ["free_time"]=> float(0) }

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:
50.69 ms | 410 KiB | 5 Q