3v4l.org

run code in 300+ PHP versions simultaneously
<?php class T { } class X { public function __construct(T $t) { $this->t = $t; } } class Builder { /** * @var T|null */ public $t; public function createX(): X { $this->validate(); // PHPStan complains that at this line, $this->t could be null, except we've already checked it isn't... // Parameter #1 $t of class X constructor expects T, T|null given. return new X($this->t); } private function validate() { if (is_null($this->t)) { throw new \Exception; } } } $builder = new Builder; $builder->t = new T; $builder->createX();

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.0120.00823.97
8.4.110.0120.00818.98
8.4.100.0040.00617.73
8.4.90.0130.00720.52
8.4.80.0100.00918.95
8.4.70.0050.00320.60
8.4.60.0130.00420.69
8.4.50.0100.00818.59
8.4.40.0120.00318.05
8.4.30.0100.00617.89
8.4.20.0070.00417.88
8.4.10.0100.00619.35
8.3.250.0020.00718.84
8.3.240.0020.00617.32
8.3.230.0120.00816.49
8.3.220.0060.00418.95
8.3.210.0030.00518.42
8.3.200.0050.00416.75
8.3.190.0090.00618.89
8.3.180.0100.00918.89
8.3.170.0060.01217.29
8.3.160.0140.00716.65
8.3.150.0100.00716.86
8.3.140.0070.01116.61
8.3.130.0060.00318.36
8.3.120.0000.00819.04
8.3.110.0040.00420.94
8.3.100.0080.00024.06
8.3.90.0080.00026.77
8.3.80.0090.00017.97
8.3.70.0180.00018.43
8.3.60.0120.00318.80
8.3.50.0090.00717.67
8.3.40.0120.00418.84
8.3.30.0070.00718.70
8.3.20.0040.00419.11
8.3.10.0100.00021.85
8.3.00.0050.00323.66
8.2.290.0130.00620.56
8.2.280.0100.00920.31
8.2.270.0040.01816.84
8.2.260.0060.01217.36
8.2.250.0060.00316.99
8.2.240.0060.00317.06
8.2.230.0090.00022.58
8.2.220.0060.00337.54
8.2.210.0070.01026.77
8.2.200.0100.00018.16
8.2.190.0100.00316.75
8.2.180.0070.00718.18
8.2.170.0040.01422.96
8.2.160.0090.00618.87
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0040.00419.95
8.2.120.0040.00426.35
8.2.110.0090.00320.93
8.2.100.0060.00617.83
8.2.90.0000.00919.22
8.2.80.0030.00517.97
8.2.70.0060.00318.04
8.2.60.0040.00417.93
8.2.50.0000.00818.10
8.2.40.0030.00521.25
8.2.30.0050.00319.08
8.2.20.0000.00717.91
8.2.10.0000.00717.88
8.2.00.0040.00419.38
8.1.330.0120.00521.83
8.1.320.0100.00918.06
8.1.310.0120.00618.68
8.1.300.0090.00016.05
8.1.290.0030.00730.84
8.1.280.0110.00425.92
8.1.270.0030.00522.14
8.1.260.0040.00426.35
8.1.250.0030.00528.09
8.1.240.0000.01122.33
8.1.230.0040.00820.86
8.1.220.0040.00417.74
8.1.210.0040.00418.83
8.1.200.0030.00617.35
8.1.190.0040.00417.23
8.1.180.0050.00318.10
8.1.170.0080.00018.81
8.1.160.0020.00518.73
8.1.150.0040.00418.76
8.1.140.0040.00417.55
8.1.130.0070.00019.02
8.1.120.0080.00017.45
8.1.110.0000.00717.36
8.1.100.0030.00417.40
8.1.90.0000.01017.33
8.1.80.0000.00717.44
8.1.70.0000.00717.43
8.1.60.0000.00817.43
8.1.50.0030.00517.41
8.1.40.0070.00017.54
8.1.30.0040.00417.58
8.1.20.0040.00417.49
8.1.10.0000.00917.45
8.1.00.0040.00417.37
8.0.300.0040.00419.82
8.0.290.0080.00016.63
8.0.280.0070.00018.38
8.0.270.0000.00717.20
8.0.260.0060.00017.20
8.0.250.0030.00316.93
8.0.240.0000.00716.95
8.0.230.0000.00716.96
8.0.220.0050.00216.80
8.0.210.0070.00016.79
8.0.200.0030.00316.85
8.0.190.0040.00417.00
8.0.180.0080.00016.96
8.0.170.0080.00016.81
8.0.160.0070.00016.91
8.0.150.0040.00416.86
8.0.140.0040.00416.80
8.0.130.0050.00013.36
8.0.120.0060.00316.88
8.0.110.0000.00716.88
8.0.100.0040.00416.94
8.0.90.0040.00417.02
8.0.80.0060.01016.81
8.0.70.0000.00716.83
8.0.60.0040.00416.71
8.0.50.0000.00716.81
8.0.30.0110.00916.98
8.0.20.0110.00717.40
8.0.10.0080.00016.80
8.0.00.0130.00716.68
7.4.330.0000.00415.55
7.4.320.0060.00016.59
7.4.300.0030.00316.49
7.4.290.0030.00316.58
7.4.280.0030.00516.41
7.4.270.0000.00716.50
7.4.260.0000.00716.59
7.4.250.0000.00816.56
7.4.240.0000.00716.46
7.4.230.0000.00716.67
7.4.220.0040.00416.39
7.4.210.0060.00916.60
7.4.200.0070.00016.49
7.4.160.0090.00816.54
7.4.140.0130.00717.86
7.4.130.0030.01616.52
7.4.120.0090.01016.43
7.4.110.0100.00716.34
7.4.100.0100.00616.50
7.4.90.0060.01416.56
7.4.80.0080.00919.39
7.4.70.0070.01716.58
7.4.60.0060.01516.52
7.4.50.0090.00616.55
7.4.40.0070.01016.39
7.4.00.0000.01714.95
7.3.330.0000.00513.30
7.3.320.0030.00313.22
7.3.310.0070.00016.36
7.3.300.0000.00816.34
7.3.290.0000.00716.30
7.3.280.0080.01016.31
7.3.260.0090.00816.37
7.3.240.0100.00816.51
7.3.230.0170.00316.43
7.3.210.0130.00316.53
7.3.200.0060.01016.37
7.3.190.0140.00316.49
7.3.180.0070.01016.54
7.3.170.0060.01016.24
7.3.160.0150.00616.37
7.2.330.0130.00616.80
7.2.320.0140.00516.44
7.2.310.0090.00916.64
7.2.300.0120.00616.64
7.2.290.0100.01016.27
7.2.70.0110.00717.07
7.2.60.0130.00316.72
7.2.50.0100.01016.95
7.2.40.0090.00916.80
7.2.30.0030.01016.94
7.2.20.0000.01416.66
7.2.10.0140.00616.82
7.2.00.0000.01516.93
7.1.200.0030.00315.75
7.1.170.0040.01415.61
7.1.160.0100.00615.83
7.1.150.0090.00615.84
7.1.140.0040.00915.87
7.1.130.0140.00015.74
7.1.120.0130.00315.72
7.1.110.0090.00615.76
7.1.100.0030.01015.43
7.1.90.0100.00715.55
7.1.80.0000.01315.96
7.1.70.0060.00615.89
7.1.60.0240.00733.73
7.1.50.0230.01033.73
7.1.40.0200.02033.46
7.1.30.0130.01733.45
7.1.20.0210.01733.71
7.1.10.0070.01015.67
7.1.00.0030.01115.68

preferences:
28.93 ms | 403 KiB | 5 Q