3v4l.org

run code in 500+ PHP versions simultaneously
<?php class A {} class B {} class X { private function create(string $class): A|B { return new $class(); } public function createA(): A { return $this->create('A'); } public function createB(): B { return $this->create('B'); } } $test = new X; $new = $test->createB(); var_export($new);

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.5.30.0120.00519.46
8.5.20.0100.00720.05
8.5.10.0110.00619.99
8.5.00.0150.00620.18
8.4.180.0140.00725.65
8.4.170.0160.00523.88
8.4.160.0150.00623.93
8.4.150.0060.00716.89
8.4.140.0140.00617.47
8.4.130.0050.00417.70
8.4.120.0060.00520.39
8.4.110.0080.00124.20
8.4.100.0090.01117.61
8.4.90.0120.00518.52
8.4.80.0110.01017.81
8.4.70.0040.00517.76
8.4.60.0140.00618.76
8.4.50.0080.00520.27
8.4.40.0080.00317.60
8.4.30.0060.01320.57
8.4.20.0130.00724.07
8.4.10.0090.00024.00
8.3.300.0140.00624.53
8.3.290.0130.00818.23
8.3.280.0080.00416.21
8.3.270.0090.01216.35
8.3.260.0120.00616.44
8.3.250.0050.00318.81
8.3.240.0020.00716.59
8.3.230.0120.00716.36
8.3.220.0090.00916.96
8.3.210.0030.00518.28
8.3.200.0050.00416.38
8.3.190.0100.00817.14
8.3.180.0100.00816.34
8.3.170.0140.00018.76
8.3.160.0110.00716.57
8.3.150.0100.00720.93
8.3.140.0040.00417.15
8.3.130.0130.00718.18
8.3.120.0090.00319.04
8.3.110.0080.00820.94
8.3.100.0080.00018.38
8.3.90.0040.01126.77
8.3.80.0060.00318.18
8.3.70.0100.00716.75
8.3.60.0150.00616.50
8.3.50.0120.00916.54
8.3.40.0120.00420.09
8.3.30.0100.00718.71
8.3.20.0040.00424.18
8.3.10.0040.00424.66
8.3.00.0040.00426.16
8.2.300.0120.00918.00
8.2.290.0090.00920.26
8.2.280.0070.00118.37
8.2.270.0140.00717.02
8.2.260.0040.00416.48
8.2.250.0060.00918.23
8.2.240.0060.00918.64
8.2.230.0000.00922.58
8.2.220.0060.00324.06
8.2.210.0080.01226.77
8.2.200.0110.00016.75
8.2.190.0160.00316.58
8.2.180.0150.00325.92
8.2.170.0110.00418.82
8.2.160.0080.00522.96
8.2.150.0050.00225.66
8.2.140.0080.00024.66
8.2.130.0050.00326.16
8.2.120.0080.00026.16
8.2.110.0000.00919.05
8.2.100.0090.00317.59
8.2.90.0030.00517.50
8.2.80.0040.00418.61
8.2.70.0030.00517.75
8.2.60.0030.00617.63
8.2.50.0080.00017.63
8.2.40.0080.00817.62
8.2.30.0140.00217.62
8.2.20.0140.00217.62
8.2.10.0130.00417.62
8.2.00.0130.00317.62
8.1.340.0110.01118.33
8.1.330.0060.00522.04
8.1.320.0100.00915.86
8.1.310.0120.00618.11
8.1.300.0030.00620.12
8.1.290.0090.00030.84
8.1.280.0070.00725.92
8.1.270.0070.00024.66
8.1.260.0060.00326.35
8.1.250.0070.00028.09
8.1.240.0030.00717.66
8.1.230.0040.00720.44
8.1.220.0080.00017.74
8.1.210.0000.00818.77
8.1.200.0000.01017.48
8.1.190.0000.00817.23
8.1.180.0040.00418.10
8.1.170.0130.00317.62
8.1.160.0060.00917.62
8.1.150.0150.00217.62
8.1.140.0100.00617.62
8.1.130.0150.00117.62
8.1.120.0150.00117.62
8.1.110.0090.00717.62
8.1.100.0080.01017.62
8.1.90.0100.00717.62
8.1.80.0130.00317.62
8.1.70.0120.00417.62
8.1.60.0120.00617.62
8.1.50.0120.00517.62
8.1.40.0130.00417.62
8.1.30.0110.00717.62
8.1.20.0160.00317.62
8.1.10.0160.00317.62
8.1.00.0120.00517.62
8.0.300.0030.00618.78
8.0.290.0040.00416.58
8.0.280.0120.00417.62
8.0.270.0120.00417.62
8.0.260.0130.00317.62
8.0.250.0120.00417.62
8.0.240.0100.00717.62
8.0.230.0120.00417.62
8.0.220.0160.00017.62
8.0.210.0080.00817.62
8.0.200.0090.00817.62
8.0.190.0100.00617.62
8.0.180.0140.00417.62
8.0.170.0110.00617.62
8.0.160.0110.00617.62
8.0.150.0130.00417.62
8.0.140.0100.00617.62
8.0.130.0120.00417.62
8.0.120.0110.00617.62
8.0.110.0140.00117.62
8.0.100.0140.00317.62
8.0.90.0100.00717.62
8.0.80.0120.00617.62
8.0.70.0120.00517.62
8.0.60.0140.00317.62
8.0.50.0090.00717.62
8.0.30.0130.00517.62
8.0.20.0110.00617.62
8.0.10.0140.00317.62

preferences:
44.61 ms | 1100 KiB | 5 Q