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(); // assert($this->t !== NULL); works here xD // 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() { // assert($this->t !== NULL); does not work here xD 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.0100.01323.86
8.4.110.0130.00818.78
8.4.100.0090.01117.96
8.4.90.0110.00820.65
8.4.80.0060.00418.72
8.4.70.0120.00222.42
8.4.60.0120.00820.71
8.4.50.0120.00818.82
8.4.40.0130.00717.91
8.4.30.0070.01317.80
8.4.20.0130.00717.61
8.4.10.0100.01019.38
8.3.250.0050.00418.86
8.3.240.0090.00917.00
8.3.230.0130.00616.66
8.3.220.0040.00418.86
8.3.210.0070.00716.79
8.3.200.0050.00316.74
8.3.190.0120.00818.93
8.3.180.0100.00818.95
8.3.170.0100.00717.23
8.3.160.0110.00716.72
8.3.150.0120.00616.58
8.3.140.0070.01016.56
8.3.130.0030.00618.46
8.3.120.0110.00018.98
8.3.110.0070.00720.94
8.3.100.0030.00524.06
8.3.90.0100.00726.77
8.3.80.0090.00018.56
8.3.70.0130.00318.55
8.3.60.0090.00918.39
8.3.50.0080.00518.41
8.3.40.0070.00718.90
8.3.30.0120.00318.79
8.3.20.0000.00819.03
8.3.10.0080.00021.71
8.3.00.0080.00023.66
8.2.290.0080.01020.39
8.2.280.0090.01020.14
8.2.270.0150.00416.82
8.2.260.0070.00717.27
8.2.250.0140.00716.55
8.2.240.0090.00019.07
8.2.230.0060.00322.58
8.2.220.0050.00537.54
8.2.210.0000.00826.77
8.2.200.0070.00318.29
8.2.190.0110.00716.58
8.2.180.0140.00016.50
8.2.170.0110.00322.96
8.2.160.0100.00319.07
8.2.150.0040.00424.18
8.2.140.0050.00224.66
8.2.130.0000.00926.16
8.2.120.0030.00619.74
8.2.110.0090.00021.07
8.2.100.0120.00017.78
8.2.90.0000.00919.14
8.2.80.0000.00817.97
8.2.70.0050.00317.93
8.2.60.0040.00417.80
8.2.50.0040.00418.10
8.2.40.0050.00219.30
8.2.30.0000.00719.17
8.2.20.0000.00918.02
8.2.10.0040.00418.00
8.2.00.0050.00219.22
8.1.330.0100.00921.98
8.1.320.0100.00917.86
8.1.310.0040.00418.63
8.1.300.0050.00518.11
8.1.290.0040.00730.84
8.1.280.0130.00825.92
8.1.270.0000.00923.99
8.1.260.0040.00426.35
8.1.250.0070.00028.09
8.1.240.0040.00817.36
8.1.230.0060.00618.86
8.1.220.0050.00317.74
8.1.210.0060.00318.77
8.1.200.0060.00317.25
8.1.190.0040.00517.13
8.1.180.0040.00418.10
8.1.170.0060.00318.77
8.1.160.0040.00418.84
8.1.150.0030.00718.88
8.1.140.0050.00217.74
8.1.130.0000.00919.01
8.1.120.0000.00717.35
8.1.110.0060.00317.29
8.1.100.0040.00417.43
8.1.90.0030.00317.38
8.1.80.0000.00717.41
8.1.70.0080.00017.29
8.1.60.0000.00817.50
8.1.50.0080.00017.41
8.1.40.0000.00817.51
8.1.30.0000.00817.64
8.1.20.0040.00417.60
8.1.10.0040.00417.54
8.1.00.0030.00517.60
8.0.300.0040.00418.77
8.0.290.0040.00416.75
8.0.280.0030.00318.43
8.0.270.0030.00516.82
8.0.260.0040.00417.11
8.0.250.0000.01116.96
8.0.240.0030.00316.95
8.0.230.0030.00316.83
8.0.220.0110.00016.88
8.0.210.0000.00716.90
8.0.200.0000.00816.95
8.0.190.0040.00416.82
8.0.180.0030.00616.98
8.0.170.0050.00316.91
8.0.160.0070.00016.93
8.0.150.0000.00716.80
8.0.140.0000.00716.88
8.0.130.0050.00213.33
8.0.120.0040.00416.88
8.0.110.0000.00816.88
8.0.100.0000.00716.85
8.0.90.0000.00716.84
8.0.80.0120.00316.81
8.0.70.0080.00016.93
8.0.60.0050.00216.96
8.0.50.0040.00416.84
8.0.30.0100.00817.00
8.0.20.0100.00817.40
8.0.10.0070.00016.91
8.0.00.0160.00816.66
7.4.330.0030.00315.55
7.4.320.0050.00316.59
7.4.300.0000.00716.58
7.4.290.0000.00716.63
7.4.280.0030.00616.41
7.4.270.0030.00316.51
7.4.260.0030.00316.49
7.4.250.0030.00316.42
7.4.240.0000.00716.37
7.4.230.0030.00316.40
7.4.220.0040.00416.59
7.4.210.0070.01116.66
7.4.200.0000.00716.41
7.4.160.0060.01016.42
7.4.140.0080.01017.86
7.4.130.0120.01216.51
7.4.120.0090.01016.50
7.4.110.0030.01316.45
7.4.100.0100.00716.47
7.4.90.0070.01316.46
7.4.80.0140.00319.39
7.4.70.0060.01216.38
7.4.60.0060.01616.46
7.4.50.0030.01216.38
7.4.40.0070.01216.74
7.4.00.0060.01215.06
7.3.330.0050.00013.23
7.3.320.0000.00613.16
7.3.310.0030.00316.31
7.3.300.0000.00716.17
7.3.290.0070.00016.24
7.3.280.0120.00916.29
7.3.260.0120.01016.45
7.3.240.0110.00816.44
7.3.230.0040.01516.58
7.3.210.0130.01016.19
7.3.200.0000.01716.33
7.3.190.0090.00716.28
7.3.180.0060.00916.42
7.3.170.0120.00316.27
7.3.160.0150.00316.29
7.3.120.0070.01114.88
7.3.110.0070.00715.00
7.3.100.0040.01214.93
7.3.90.0110.00714.54
7.3.80.0090.00015.05
7.3.70.0090.00314.81
7.3.60.0070.00414.83
7.3.50.0040.01114.50
7.3.40.0060.00914.83
7.3.30.0000.01414.83
7.3.20.0040.01516.32
7.3.10.0030.01016.63
7.3.00.0080.00816.56
7.2.330.0080.00816.80
7.2.320.0060.00916.68
7.2.310.0150.00616.78
7.2.300.0030.01316.84
7.2.290.0150.00616.72
7.2.250.0060.00914.98
7.2.240.0090.01214.85
7.2.230.0100.00614.95
7.2.220.0000.00915.00
7.2.210.0060.01015.30
7.2.200.0110.00715.08
7.2.190.0000.01014.96
7.2.180.0110.00015.23
7.2.170.0090.00615.08
7.2.70.0050.01616.69
7.2.60.0090.01016.71
7.2.50.0120.00616.75
7.2.40.0110.00817.01
7.2.30.0060.01216.78
7.2.20.0090.00916.85
7.2.10.0100.00716.93
7.2.00.0120.00616.94
7.1.330.0000.01415.69
7.1.320.0060.00615.62
7.1.310.0060.00615.49
7.1.300.0080.00315.70
7.1.290.0100.00715.96
7.1.280.0000.01415.75
7.1.270.0060.01315.54
7.1.260.0030.00715.39
7.1.200.0030.00915.92
7.1.170.0080.00815.42
7.1.160.0150.00415.54
7.1.150.0090.00515.65
7.1.140.0040.01115.79
7.1.130.0000.01515.67
7.1.120.0030.01215.61
7.1.110.0070.01115.48
7.1.100.0030.01315.77
7.1.90.0080.00815.70
7.1.80.0070.00715.82
7.1.70.0100.00315.56
7.1.60.0240.01033.82
7.1.50.0250.00933.46
7.1.40.0380.01033.68
7.1.30.0340.00733.48
7.1.20.0200.02333.56
7.1.10.0100.00715.74
7.1.00.0060.01115.59

preferences:
28.09 ms | 403 KiB | 5 Q