3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** @template T of string|null */ class StringOrNull { /** @var T */ public ?string $value; /** @param T $value */ public function __construct(?string $value) { $this->value = $value; } /** * @template T2 of string|int * @param T2 $value * @psalm-this-out self<T2> */ public function setFromStringOrInt(string|int $value): void { if (is_string($value)) { // This is a separate issue, probably https://github.com/vimeo/psalm/issues/7739 $this->value = $value; } } } class Foo { /** @var list<StringOrNull<null>> */ private array $nulls = []; /** @param list<StringOrNull<null>> $nulls */ public function __construct(array $nulls) { $this->nulls = $nulls; } public function assertAllNull(): void { foreach ($this->nulls as $null) { assert($null->value === null); } } } $stringOrNull = new StringOrNull(null); $foo = new Foo([$stringOrNull]); $stringOrNull->setFromStringOrInt("foobar"); $foo->assertAllNull();

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.3.130.0040.01118.50
8.3.120.0060.00318.88
8.3.110.0040.00416.74
8.3.100.0130.00316.68
8.3.90.0070.00026.77
8.3.80.0030.00616.50
8.3.70.0070.01118.68
8.3.60.0140.00416.75
8.3.50.0130.01020.11
8.3.40.0130.00620.38
8.3.30.0120.00319.02
8.3.20.0080.00024.18
8.3.10.0040.00424.66
8.3.00.0070.00026.16
8.2.250.0040.00417.02
8.2.240.0060.00318.30
8.2.230.0080.00020.94
8.2.220.0110.00724.06
8.2.210.0120.00326.77
8.2.200.0040.00416.88
8.2.190.0090.00616.88
8.2.180.0060.00925.92
8.2.170.0130.00619.04
8.2.160.0140.00022.96
8.2.150.0040.00425.66
8.2.140.0000.00724.66
8.2.130.0000.00826.16
8.2.120.0070.00026.16
8.2.110.0030.00621.04
8.2.100.0030.00917.85
8.2.90.0030.00519.15
8.2.80.0030.00517.97
8.2.70.0030.00617.75
8.2.60.0030.00619.66
8.2.50.0040.00418.07
8.2.40.0000.00818.18
8.2.30.0000.00817.95
8.2.20.0040.00420.43
8.2.10.0000.00718.13
8.2.00.0020.00519.12
8.1.300.0090.00020.09
8.1.290.0060.00330.84
8.1.280.0070.00725.92
8.1.270.0090.00023.99
8.1.260.0040.00426.35
8.1.250.0020.00528.09
8.1.240.0090.00023.98
8.1.230.0080.00320.89
8.1.220.0000.00817.79
8.1.210.0030.00618.77
8.1.200.0000.00917.35
8.1.190.0090.00017.12
8.1.180.0090.00018.10
8.1.170.0080.00018.91
8.1.160.0040.00418.89
8.1.150.0070.00018.52
8.1.140.0000.00717.46
8.1.130.0030.00318.86
8.1.120.0000.00717.47
8.1.110.0050.00317.43
8.1.100.0040.00417.48
8.1.90.0040.00317.47
8.1.80.0030.00517.43
8.1.70.0180.00017.43
8.1.60.0140.00317.58
8.1.50.0140.00517.56
8.1.40.0100.00517.52
8.1.30.0050.00317.66
8.1.20.0090.00617.67
8.1.10.0120.00317.45
8.1.00.0100.00417.50
8.0.300.0040.00418.77
8.0.290.0050.00316.63
8.0.280.0000.00818.51
8.0.270.0070.00016.88
8.0.260.0030.00318.48
8.0.250.0030.00317.02
8.0.240.0040.00417.05
8.0.230.0000.00817.03
8.0.220.0000.00717.02
8.0.210.0070.00016.87
8.0.200.0000.01417.04
8.0.190.0090.00516.93
8.0.180.0000.01416.93
8.0.170.0040.00816.82
8.0.160.0050.01016.81
8.0.150.0120.00416.90
8.0.140.0110.00316.78
8.0.130.0120.00417.00
8.0.120.0150.00016.91
8.0.110.0100.00316.89
8.0.100.0090.00316.83
8.0.90.0100.00516.79
8.0.80.0130.00216.90
8.0.70.0090.00516.91
8.0.60.0120.00216.86
8.0.50.0090.00416.88
8.0.30.0110.00416.75
8.0.20.0030.00617.07
8.0.10.0130.00016.96
7.4.330.0030.00315.55
7.4.320.0030.00316.32
7.4.300.0040.00416.47
7.4.290.0100.00716.46
7.4.280.0070.00816.28
7.4.270.0100.00716.23
7.4.260.0080.00516.23
7.4.250.0130.00016.44
7.4.240.0090.00416.45
7.4.230.0130.00016.43
7.4.220.0140.00016.46
7.4.210.0050.01016.24
7.4.200.0100.00316.36
7.4.190.0030.01016.48
7.4.180.0060.00616.41
7.4.160.0090.00416.24
7.4.150.0070.00816.46
7.4.140.0140.00016.18
7.4.130.0080.00416.20
7.4.120.0050.00316.21
7.4.110.0050.00316.13
7.4.100.0080.00016.27
7.4.90.0030.00516.21
7.4.80.0100.00016.16
7.4.70.0090.00416.20
7.4.60.0090.00416.25
7.4.50.0060.00616.04
7.4.40.0090.00316.13
7.4.30.0080.00416.20
7.4.20.0120.00216.04
7.4.10.0070.00516.23
7.4.00.0120.00016.31

preferences:
25.45 ms | 403 KiB | 5 Q