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 { return $this->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.0080.00018.74
8.3.120.0000.01518.86
8.3.110.0030.00720.94
8.3.100.0040.01824.06
8.3.90.0040.00426.77
8.3.80.0030.00616.88
8.3.70.0100.00616.75
8.3.60.0190.00316.75
8.3.50.0140.00718.36
8.3.40.0160.00319.25
8.3.30.0110.00319.13
8.3.20.0040.00424.18
8.3.10.0050.00324.66
8.3.00.0020.00526.16
8.2.250.0120.00616.60
8.2.240.0110.00719.05
8.2.230.0090.00622.58
8.2.220.0090.00037.54
8.2.210.0070.00726.77
8.2.200.0100.00016.63
8.2.190.0150.00616.75
8.2.180.0080.01225.92
8.2.170.0110.00418.96
8.2.160.0070.00722.96
8.2.150.0000.00825.66
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0000.00721.00
8.2.110.0030.00719.27
8.2.100.0060.00617.85
8.2.90.0000.00918.09
8.2.80.0040.00419.15
8.2.70.0040.00417.75
8.2.60.0050.00317.63
8.2.50.0000.00817.98
8.2.40.0040.00419.88
8.2.30.0080.00018.18
8.2.20.0040.00420.37
8.2.10.0000.00718.07
8.2.00.0040.00419.30
8.1.300.0150.00320.22
8.1.290.0060.00330.84
8.1.280.0090.00625.92
8.1.270.0050.00323.99
8.1.260.0000.00826.35
8.1.250.0040.00428.09
8.1.240.0050.00522.18
8.1.230.0060.00620.97
8.1.220.0030.00617.78
8.1.210.0000.00818.87
8.1.200.0000.00917.00
8.1.190.0030.00517.22
8.1.180.0090.00018.10
8.1.170.0080.00017.62
8.1.160.0030.00318.90
8.1.150.0000.00818.65
8.1.140.0000.00717.46
8.1.130.0030.00318.84
8.1.120.0000.00717.37
8.1.110.0040.00417.45
8.1.100.0040.00417.43
8.1.90.0040.00417.43
8.1.80.0050.00217.43
8.1.70.0030.00317.45
8.1.60.0040.00717.60
8.1.50.0040.00417.45
8.1.40.0120.00617.49
8.1.30.0130.00517.56
8.1.20.0110.00717.59
8.1.10.0080.00917.51
8.1.00.0100.00617.41
8.0.300.0070.00019.96
8.0.290.0040.00716.75
8.0.280.0030.00318.45
8.0.270.0080.00016.95
8.0.260.0030.00318.35
8.0.250.0000.00717.05
8.0.240.0030.00316.93
8.0.230.0030.00316.99
8.0.220.0030.00516.88
8.0.210.0000.00716.98
8.0.200.0080.00016.91
8.0.190.0000.00917.03
8.0.180.0070.00016.88
8.0.170.0080.00616.84
8.0.160.0130.00416.71
8.0.150.0160.00416.74
8.0.140.0150.00416.71
8.0.130.0100.00916.83
8.0.120.0110.00716.66
8.0.110.0130.00416.69
8.0.100.0090.00716.68
8.0.90.0140.00116.89
8.0.80.0040.00416.93
8.0.70.0050.00516.84
8.0.60.0090.00716.76
8.0.50.0150.00216.58
8.0.30.0080.00816.77
8.0.20.0040.00516.67
8.0.10.0070.00616.93
7.4.330.0020.00215.55
7.4.320.0000.00716.61
7.4.300.0000.00616.63
7.4.290.0040.00416.53
7.4.280.0080.00116.45
7.4.270.0050.00316.49
7.4.260.0070.00416.46
7.4.250.0080.00616.50
7.4.240.0060.00816.29
7.4.230.0080.00116.53
7.4.220.0030.00716.45
7.4.210.0030.00916.51
7.4.200.0080.00316.49
7.4.190.0100.00316.55
7.4.180.0080.00216.58
7.4.160.0080.00316.45
7.4.150.0050.00816.50
7.4.140.0110.00316.23
7.4.130.0090.00516.11
7.4.120.0050.00716.10
7.4.110.0090.00316.26
7.4.100.0100.00416.50
7.4.90.0090.00416.13
7.4.80.0140.00216.31
7.4.70.0100.00716.43
7.4.60.0110.00616.45
7.4.50.0120.00416.18
7.4.40.0090.00716.32
7.4.30.0120.00616.33
7.4.20.0150.00416.27
7.4.10.0100.00916.28
7.4.00.0120.00116.13

preferences:
26.63 ms | 403 KiB | 5 Q