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());

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
8.5.00.0160.00620.18
8.4.150.0070.00616.85
8.4.140.0150.00917.58
8.4.130.0160.00619.30
8.4.120.0060.00522.40
8.4.110.0400.00917.92
8.4.100.0390.01217.56
8.4.90.0430.00517.58
8.4.80.0440.00717.64
8.4.70.0390.01117.68
8.4.60.0400.00917.61
8.4.50.0360.00717.98
8.4.40.0490.00617.67
8.4.30.0400.00917.52
8.4.20.0390.00517.44
8.4.10.0350.00917.50
8.3.280.0030.00014.05
8.3.270.0140.00516.38
8.3.260.0110.00916.43
8.3.250.0070.00317.35
8.3.240.0310.00816.69
8.3.230.0400.00916.28
8.3.220.0410.00616.54
8.3.210.0400.00916.53
8.3.200.0420.00616.45
8.3.190.0400.00716.32
8.3.180.0380.01016.57
8.3.170.0420.01016.41
8.3.160.0410.00916.71
8.3.150.0370.01216.40
8.3.140.0390.01216.51
8.3.130.0230.00216.29
8.3.120.0480.00616.46
8.3.110.0360.01016.34
8.3.100.0450.00616.54
8.3.90.0420.00816.61
8.3.80.0420.00916.47
8.3.70.0370.01316.55
8.3.60.0270.00616.82
8.3.50.0400.00616.65
8.3.40.0180.00517.62
8.3.30.0290.01217.57
8.3.20.0360.00517.45
8.3.10.0240.00817.52
8.3.00.0110.00317.57
8.2.290.0220.01016.76
8.2.280.0240.00716.50
8.2.270.0480.00516.45
8.2.260.0270.01016.70
8.2.250.0330.00916.41
8.2.240.0360.00616.27
8.2.230.0360.01116.36
8.2.220.0370.00816.56
8.2.210.0350.00816.74
8.2.200.0360.00616.49
8.2.190.0380.00516.28
8.2.180.0260.00516.29
8.2.170.0400.00617.70
8.2.160.0360.01017.47
8.2.150.0380.00917.76
8.2.140.0240.00417.62
8.2.130.0170.00317.74
8.2.120.0190.00417.71
8.2.110.0170.00317.38
8.2.100.0110.00917.69
8.2.90.0190.00117.73
8.2.80.0160.00417.70
8.2.70.0360.00517.31
8.2.60.0200.00617.62
8.2.50.0360.00817.11
8.2.40.0450.00917.42
8.2.30.0220.00517.38
8.2.20.0260.01017.25
8.2.10.0350.00617.50
8.2.00.0310.01117.47

preferences:
38.76 ms | 403 KiB | 5 Q