3v4l.org

run code in 300+ PHP versions simultaneously
<?php class AttemptingToRegisterServiceUsingBusyName extends Exception implements ContainerExceptionInterface{} class AttemptToObtainOrCreateUnregisteredService extends Exception implements NotFoundExceptionInterface{} class DIContainer implements ContainerInterface { private array $registered = []; private array $created = []; public function register(string $id, callable $factory): void { if ($this->has($id)) { throw new AttemptingToRegisterServiceUsingBusyName('Сервис с таким именем уже зарегистрирован.'); } $this->registered[$id] = $factory; } public function get(string $id): mixed { if (array_key_exists($id, $this->created)) { return $this->created[$id]; } elseif ($this->has($id)) { $object = call_user_func($this->registered[$id], $this); $this->created[$id] = $object; return $object; } else { throw new AttemptToObtainOrCreateUnregisteredService('Сервис с таким именем не зарегистрирован.'); } } public function has(string $id): bool { return isset($this->registered[$id]); } }

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.0060.00320.77
8.4.110.0090.00722.54
8.4.100.0090.01118.36
8.4.90.0120.00818.93
8.4.80.0090.00817.86
8.4.70.0030.00518.11
8.4.60.0150.00517.73
8.4.50.0090.01017.70
8.4.40.0060.01217.65
8.4.30.0100.01018.91
8.4.20.0110.00018.76
8.4.10.0040.00419.38
8.3.250.0050.00318.80
8.3.240.0120.00817.19
8.3.230.0140.00516.86
8.3.220.0050.00318.73
8.3.210.0080.01116.65
8.3.200.0120.00816.47
8.3.190.0060.00316.66
8.3.180.0040.00416.80
8.3.170.0070.01320.65
8.3.160.0140.00316.67
8.3.150.0150.00417.06
8.3.140.0110.00720.90
8.3.130.0040.00418.54
8.3.120.0090.00018.73
8.3.110.0030.01320.94
8.3.100.0060.00324.06
8.3.90.0080.00026.77
8.3.80.0050.00516.88
8.3.70.0150.00318.43
8.3.60.0110.00416.50
8.3.50.0120.00916.98
8.3.40.0070.00720.52
8.3.30.0040.01120.17
8.3.20.0030.00624.18
8.3.10.0120.00624.66
8.3.00.0190.00024.66
8.2.290.0120.00720.54
8.2.280.0150.00418.39
8.2.270.0030.01217.02
8.2.260.0050.00320.14
8.2.250.0040.00416.62
8.2.240.0120.00318.84
8.2.230.0030.00622.58
8.2.220.0070.00337.54
8.2.210.0050.00326.77
8.2.200.0100.00018.41
8.2.190.0090.00916.58
8.2.180.0100.01318.30
8.2.170.0030.01218.94
8.2.160.0110.00422.96
8.2.150.0080.00025.66
8.2.140.0110.00724.66
8.2.130.0190.00024.66
8.2.120.0070.01124.66
8.2.110.0090.00924.66
8.2.100.0130.00724.66
8.2.90.0130.00624.66
8.2.80.0150.00424.66
8.2.70.0150.00024.66
8.2.60.0130.00724.66
8.2.50.0070.00724.66
8.2.40.0090.00624.66
8.2.30.0080.00024.66
8.2.20.0090.00024.66
8.2.10.0090.00024.66
8.2.00.0150.00424.66
8.1.330.0100.00821.93
8.1.320.0120.00915.99
8.1.310.0000.00818.54
8.1.300.0040.00420.30
8.1.290.0060.00330.84
8.1.280.0180.00425.92
8.1.270.0040.00424.66
8.1.260.0040.00424.66
8.1.250.0040.00424.66
8.1.240.0040.00424.66
8.1.230.0040.00424.66
8.1.220.0040.00424.66
8.1.210.0150.00424.66
8.1.200.0060.00324.66
8.1.190.0140.00424.66
8.1.180.0040.00424.66
8.1.170.0070.00724.66
8.1.160.0060.00324.66
8.1.150.0050.00324.66
8.1.140.0090.00624.66
8.1.130.0040.01124.66
8.1.120.0050.00524.66
8.1.110.0150.00024.66
8.1.100.0070.01024.66
8.1.90.0090.00024.66
8.1.80.0090.00624.66
8.1.70.0070.00724.66
8.1.60.0080.00024.66
8.1.50.0060.00324.66
8.1.40.0030.00624.66
8.1.30.0060.00324.66
8.1.20.0060.00324.66
8.1.10.0070.00424.66
8.1.00.0090.00024.66

preferences:
56.31 ms | 403 KiB | 5 Q