3v4l.org

run code in 300+ PHP versions simultaneously
<?php class DIContainer1 implements ArrayAccess { private array $registered; private array $created; public function offsetSet(mixed $offset, mixed $value): void { if (is_null($offset)) { throw new DIContainerException('Обязательно должен быть указан ключ.'); } if (array_key_exists($offset, $this->registered)) { throw new DIContainerException('Нельзя использовать один и тот же ключ для нескольких элементов.'); } $this->registered[$offset] = $value; } public function offsetExists(mixed $offset): bool { return isset($this->registered[$offset]); } public function offsetUnset(mixed $offset): void { unset($this->registered[$offset]); unset($this->created[$offset]); } public function offsetGet(mixed $offset): mixed { if (array_key_exists($offset, $this->created)) { return $this->created[$offset]; } elseif (array_key_exists($offset, $this->registered)) { $object = $this->registered[$offset]($this); $this->created[$offset] = $object; return $object; } else { throw new DIContainerException('Элемент с таким ключом не зарегистрирован.'); } } }

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.4.120.0090.01023.75
8.4.110.0100.00818.91
8.4.100.0130.00718.90
8.4.90.0120.00822.17
8.4.80.0090.00517.65
8.4.70.0110.00718.00
8.4.60.0120.01018.79
8.4.50.0110.01018.71
8.4.40.0000.01217.78
8.4.30.0130.00618.90
8.4.20.0160.00418.91
8.4.10.0080.00019.23
8.3.250.0110.00818.96
8.3.240.0100.00917.11
8.3.230.0130.00616.68
8.3.220.0060.00218.91
8.3.210.0140.00516.61
8.3.200.0060.00316.55
8.3.190.0080.00817.20
8.3.180.0030.00516.37
8.3.170.0190.00020.86
8.3.160.0040.00420.32
8.3.150.0000.00716.49
8.3.140.0040.01216.63
8.3.130.0150.00416.84
8.3.120.0070.00718.82
8.3.110.0160.00320.94
8.3.100.0040.00424.06
8.3.90.0040.00426.77
8.3.80.0130.00718.30
8.3.70.0140.00716.58
8.3.60.0070.01018.56
8.3.50.0090.00616.72
8.3.40.0040.01120.47
8.3.30.0150.00320.26
8.3.20.0040.00424.18
8.3.10.0130.00724.66
8.3.00.0000.01018.66
8.2.290.0110.00920.34
8.2.280.0090.00918.63
8.2.270.0040.01118.97
8.2.260.0000.00820.11
8.2.250.0030.00718.11
8.2.240.0070.00716.96
8.2.230.0060.00322.58
8.2.220.0000.01037.54
8.2.210.0050.00326.77
8.2.200.0040.00416.75
8.2.190.0070.00718.16
8.2.180.0110.01125.92
8.2.170.0090.00618.82
8.2.160.0130.00322.96
8.2.150.0040.00425.66
8.2.140.0030.00624.66
8.2.130.0060.00318.91
8.2.120.0090.00019.02
8.2.110.0040.00418.72
8.2.100.0080.00020.50
8.2.90.0090.00018.91
8.2.80.0000.00918.60
8.2.70.0100.00018.52
8.2.60.0060.00320.32
8.2.50.0060.00320.50
8.2.40.0080.00020.38
8.2.30.0040.00420.43
8.2.20.0040.00420.39
8.2.10.0000.00920.35
8.2.00.0040.00420.49
8.1.330.0150.00521.82
8.1.320.0120.00916.04
8.1.310.0070.01118.26
8.1.300.0080.01118.37
8.1.290.0030.00630.84
8.1.280.0070.01025.92
8.1.270.0080.00020.55
8.1.260.0040.00423.86
8.1.250.0000.00823.85
8.1.240.0090.00020.27
8.1.230.0080.00019.98
8.1.220.0080.00020.28
8.1.210.0090.00020.25
8.1.200.0060.00320.22
8.1.190.0050.00320.41
8.1.180.0050.00320.21
8.1.170.0060.00320.14
8.1.160.0000.00820.18
8.1.150.0090.00020.14
8.1.140.0040.00420.28
8.1.130.0000.00820.56
8.1.120.0040.00420.29
8.1.110.0090.00020.28
8.1.100.0040.00420.08
8.1.90.0040.00420.29
8.1.80.0000.00820.20
8.1.70.0000.00920.20
8.1.60.0090.00020.41
8.1.50.0050.00520.29
8.1.40.0040.00420.33
8.1.30.0030.00620.47
8.1.20.0060.00320.53
8.1.10.0100.00020.34
8.1.00.0040.00420.17

preferences:
22.43 ms | 403 KiB | 5 Q