3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** @template T */ class InvariantCollection { /** @var list<T> */ public $values; /** @param list<T> $values */ public function __construct($values) { $this->values = $values; } } class Foo {} class Bar extends Foo {} class FooBar { /** @var InvariantCollection<Bar> */ private $bars; public function __construct() { $this->bars = new InvariantCollection([new Bar()]); } /** @return InvariantCollection<Foo> */ public function getFoos(): InvariantCollection { $bars = $this->bars; return $bars; } public function check(): void { foreach ($this->bars->values as $bar) { if (!$bar instanceof Bar) { throw new \Exception("Illegally modified!"); } } } } $foobar = new FooBar(); $foos = $foobar->getFoos(); $foos->values[] = new Foo(); $foobar->check();

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.0000.00816.59
8.3.120.0000.01518.81
8.3.110.0030.00620.94
8.3.100.0060.00324.06
8.3.90.0000.00826.77
8.3.80.0060.00316.63
8.3.70.0100.00717.00
8.3.60.0100.00716.75
8.3.50.0090.00918.42
8.3.40.0090.00619.36
8.3.30.0030.01019.21
8.3.20.0040.00424.18
8.3.10.0040.00424.66
8.3.00.0040.00426.16
8.2.250.0090.00918.57
8.2.240.0050.00518.79
8.2.230.0030.00622.58
8.2.220.0000.00837.54
8.2.210.0160.00326.77
8.2.200.0000.00917.00
8.2.190.0070.00716.72
8.2.180.0060.01225.92
8.2.170.0150.00019.09
8.2.160.0100.00722.96
8.2.150.0080.00025.66
8.2.140.0070.00024.66
8.2.130.0000.00726.16
8.2.120.0070.00026.16
8.2.110.0100.00019.30
8.2.100.0030.01017.84
8.2.90.0080.00018.00
8.2.80.0030.00617.97
8.2.70.0060.00317.88
8.2.60.0000.00817.63
8.2.50.0040.00417.98
8.2.40.0000.00820.01
8.2.30.0050.00318.07
8.2.20.0040.00420.50
8.2.10.0000.00718.04
8.2.00.0040.00419.20
8.1.300.0030.00718.16
8.1.290.0040.00418.88
8.1.280.0060.00925.92
8.1.270.0060.00323.99
8.1.260.0000.00826.35
8.1.250.0030.00728.09
8.1.240.0060.00322.73
8.1.230.0090.00317.82
8.1.220.0030.00517.74
8.1.210.0040.00418.77
8.1.200.0060.00317.38
8.1.190.0050.00317.25
8.1.180.0050.00518.10
8.1.170.0080.00417.62
8.1.160.0000.00718.84
8.1.150.0000.00718.68
8.1.140.0040.00417.39
8.1.130.0030.00318.91
8.1.120.0040.00417.33
8.1.110.0040.00417.46
8.1.100.0000.00717.49
8.1.90.0000.00717.36
8.1.80.0060.00317.46
8.1.70.0000.00717.39
8.1.60.0000.00817.60
8.1.50.0040.00417.58
8.1.40.0050.00817.54
8.1.30.0090.00317.51
8.1.20.0000.01017.58
8.1.10.0140.00017.54
8.1.00.0030.01017.38
8.0.300.0040.00418.77
8.0.290.0040.00416.63
8.0.280.0030.00318.39
8.0.270.0000.00716.85
8.0.260.0030.00318.46
8.0.250.0060.00317.02
8.0.240.0030.00317.05
8.0.230.0000.00716.93
8.0.220.0000.00716.92
8.0.210.0080.00016.95
8.0.200.0050.00216.94
8.0.190.0040.00417.02
8.0.180.0080.00016.87
8.0.170.0030.00716.86
8.0.160.0030.00716.87
8.0.150.0070.00716.69
8.0.140.0030.00716.91
8.0.130.0080.00016.77
8.0.120.0100.00016.85
8.0.110.0000.01016.95
8.0.100.0090.00317.01
8.0.90.0030.00716.79
8.0.80.0030.00716.91
8.0.70.0020.00716.95
8.0.60.0060.00316.88
8.0.50.0110.00016.87
8.0.30.0130.00016.86
8.0.20.0130.00016.96
8.0.10.0000.01216.94
7.4.330.0030.00315.55
7.4.320.0050.00316.52
7.4.300.0070.00016.52
7.4.290.0030.00316.43
7.4.280.0070.00316.48
7.4.270.0080.00316.63
7.4.260.0060.00616.51
7.4.250.0100.00316.37
7.4.240.0080.00416.58
7.4.230.0060.00616.58
7.4.220.0080.00416.50
7.4.210.0000.00916.40
7.4.200.0030.00816.40
7.4.190.0070.00316.57
7.4.180.0000.01016.46
7.4.160.0030.00616.57
7.4.150.0100.00016.54
7.4.140.0050.00516.45
7.4.130.0080.00416.44
7.4.120.0080.00316.58
7.4.110.0130.00016.34
7.4.100.0140.00016.50
7.4.90.0070.00716.16
7.4.80.0120.00016.27
7.4.70.0040.00716.26
7.4.60.0030.00916.41
7.4.50.0060.00316.20
7.4.40.0100.00016.41
7.4.30.0070.00716.46
7.4.20.0030.00616.32
7.4.10.0050.00516.36
7.4.00.0090.00416.43

preferences:
26.96 ms | 403 KiB | 5 Q