3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface response { public function getResponseClass(); } class foo implements response { public $type = 'foo'; public function getResponseClass() { return 'hello'; } } class bar implements response { public $type = 'bar'; public function getResponseClass() { return 'world'; } } class hello { } class world { } class process { public function test1($a) { switch ($a->type) { case 'foo': return new hello(); case 'bar': return new world(); } } public function test2($a) { $class = $a->getResponseClass(); return new $class; } } $p = new process; var_dump($p->test1(new bar())); var_dump($p->test2(new bar()));

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.60.0040.01118.32
8.3.50.0100.00318.15
8.3.40.0030.01018.67
8.3.30.0000.01519.09
8.3.20.0040.00420.34
8.3.10.0070.00021.59
8.3.00.0040.00419.26
8.2.180.0000.02016.75
8.2.170.0100.01022.96
8.2.160.0070.00722.29
8.2.150.0040.00424.18
8.2.140.0000.00824.66
8.2.130.0050.00226.16
8.2.120.0050.00219.77
8.2.110.0030.00622.30
8.2.100.0000.01117.84
8.2.90.0070.00019.05
8.2.80.0040.00417.97
8.2.70.0000.00817.63
8.2.60.0030.00617.93
8.2.50.0040.00418.07
8.2.40.0040.00418.09
8.2.30.0030.00618.10
8.2.20.0040.00417.60
8.2.10.0060.00318.10
8.2.00.0080.00017.66
8.1.280.0030.01725.92
8.1.270.0030.00618.84
8.1.260.0000.00726.35
8.1.250.0000.00728.09
8.1.240.0060.00323.97
8.1.230.0060.00619.22
8.1.220.0060.00317.77
8.1.210.0000.00818.77
8.1.200.0070.00617.13
8.1.190.0040.00417.13
8.1.180.0040.00418.10
8.1.170.0040.00418.59
8.1.160.0000.00721.94
8.1.150.0040.00418.79
8.1.140.0030.00519.14
8.1.130.0030.00317.86
8.1.120.0040.00417.35
8.1.110.0000.00717.50
8.1.100.0070.00017.44
8.1.90.0040.00417.48
8.1.80.0070.00017.36
8.1.70.0030.00317.39
8.1.60.0050.00317.62
8.1.50.0000.00817.45
8.1.40.0060.00317.43
8.1.30.0000.00917.68
8.1.20.0060.00317.73
8.1.10.0000.00817.61
8.1.00.0040.00417.39
8.0.300.0040.00418.77
8.0.290.0040.00416.88
8.0.280.0030.00318.40
8.0.270.0000.00717.29
8.0.260.0000.00717.29
8.0.250.0060.00017.02
8.0.240.0030.00316.98
8.0.230.0030.00316.94
8.0.220.0000.00716.94
8.0.210.0000.00716.94
8.0.200.0050.00317.03
8.0.190.0040.00416.99
8.0.180.0040.00416.84
8.0.170.0000.00716.91
8.0.160.0000.00716.87
8.0.150.0000.00816.91
8.0.140.0000.00716.90
8.0.130.0030.00313.41
8.0.120.0030.00516.80
8.0.110.0080.00016.95
8.0.100.0000.00716.86
8.0.90.0000.00816.84
8.0.80.0030.01316.98
8.0.70.0000.00816.79
8.0.60.0000.00716.90
8.0.50.0000.00716.95
8.0.30.0170.00616.89
8.0.20.0140.00717.40
8.0.10.0040.00417.17
8.0.00.0070.01016.79
7.4.330.0050.00015.03
7.4.320.0000.00616.59
7.4.300.0000.00616.46
7.4.290.0030.00316.68
7.4.280.0040.00416.43
7.4.270.0030.00316.63
7.4.260.0080.00016.58
7.4.250.0070.00016.46
7.4.240.0040.00416.54
7.4.230.0030.00316.54
7.4.220.0040.01416.63
7.4.210.0040.01116.66
7.4.200.0040.00416.65
7.4.160.0130.00316.39
7.4.150.0000.01817.40
7.4.140.0090.00917.86
7.4.130.0120.00716.52
7.4.120.0090.00916.59
7.4.110.0100.01416.74
7.4.100.0150.00316.59
7.4.90.0140.00316.46
7.4.80.0120.00919.39
7.4.70.0060.01816.59
7.4.60.0070.01016.63
7.4.50.0050.00316.60
7.4.40.0030.01316.61
7.4.30.0150.00716.43
7.4.00.0030.01014.66
7.3.330.0080.00013.34
7.3.320.0000.00513.41
7.3.310.0030.00316.34
7.3.300.0030.00316.38
7.3.290.0040.01016.33
7.3.280.0080.00916.28
7.3.270.0110.00617.40
7.3.260.0120.00616.35
7.3.250.0140.01816.50
7.3.240.0100.00716.43
7.3.230.0070.01016.52
7.3.210.0090.01216.52
7.3.200.0030.01319.39
7.3.190.0040.01116.59
7.3.180.0080.00816.29
7.3.170.0060.01216.65
7.3.160.0090.01316.42
7.2.330.0090.00916.40
7.2.320.0120.01016.44
7.2.310.0060.01616.77
7.2.300.0100.00716.25
7.2.290.0100.01316.46
7.2.60.0060.00616.55
7.2.00.0030.01019.61
7.1.200.0060.00615.98
7.1.100.0100.00318.20
7.1.70.0040.00417.14
7.1.60.0070.01719.46
7.1.50.0100.01316.89
7.1.00.0030.07722.30
7.0.200.0050.00316.93
7.0.140.0000.06021.95
7.0.60.0100.03719.97
7.0.50.0070.05017.88
7.0.40.0000.09020.40
7.0.30.0300.07320.19
7.0.20.0200.06720.07
7.0.10.0030.09020.23
7.0.00.0030.04320.15
5.6.210.0130.06020.52
5.6.200.0000.04718.15
5.6.190.0070.05720.52
5.6.180.0270.04320.48
5.6.170.0230.04720.56
5.6.160.0030.04020.39
5.6.150.0030.08318.25
5.6.140.0130.06018.17
5.6.130.0100.07718.29
5.6.120.0000.04721.00
5.6.110.0130.07321.15
5.6.100.0030.05020.99
5.6.90.0070.07321.11
5.6.80.0100.08020.53
5.5.350.4000.03020.34
5.5.340.0070.06017.95
5.5.330.0000.05720.25
5.5.320.2100.03320.36
5.5.310.0400.04020.21
5.5.300.0030.04317.94
5.5.290.0130.07317.95
5.5.280.0100.08320.91
5.5.270.0030.04720.79
5.5.260.0200.07020.81
5.5.250.0100.04320.67
5.5.240.0000.08020.21
5.4.450.0570.06019.61
5.4.440.0670.05019.47
5.4.430.0170.05319.51
5.4.420.0130.05019.45
5.4.410.0100.05319.40
5.4.400.0130.05018.92
5.4.390.0870.05718.61
5.4.380.1030.05318.76
5.4.370.0930.05318.55
5.4.360.0900.05318.73
5.4.350.0870.05718.53
5.4.340.0930.05018.68
5.4.320.0930.05718.62
5.4.310.1000.05318.72
5.4.300.0970.04718.69
5.4.290.0970.05318.53
5.4.280.0930.05018.46
5.4.270.0930.05318.55
5.4.260.1000.05318.66
5.4.250.1070.04318.68
5.4.240.0900.05718.55
5.4.230.0970.05018.75
5.4.220.0900.06318.71
5.4.210.1030.04718.73
5.4.200.0830.05716.54
5.4.190.1030.05018.70
5.4.180.0970.05318.75
5.4.170.0830.05318.69
5.4.160.0770.05718.53
5.4.150.0830.05318.54
5.4.140.0830.04716.38
5.4.130.0930.06016.29
5.4.120.0830.04316.36
5.4.110.0870.05016.21
5.4.100.0770.05016.29
5.4.90.0700.05716.30
5.4.80.0700.05716.43
5.4.70.0730.05316.34
5.4.60.0730.05316.31
5.4.50.0930.04716.32
5.4.40.0930.05016.26
5.4.30.0900.05316.15
5.4.20.0800.05016.39
5.4.10.0770.05016.23
5.4.00.0870.04315.75
5.3.290.0870.06014.78
5.3.280.0870.04714.66
5.3.270.0930.05314.82
5.3.260.0900.06014.79
5.3.250.0930.05014.68
5.3.240.1000.04014.67
5.3.230.0870.05314.72
5.3.220.0730.05714.77
5.3.210.0830.05314.62
5.3.200.0770.05014.62
5.3.190.0830.05314.76
5.3.180.0800.05314.56
5.3.170.0770.05014.68
5.3.160.0800.05014.69
5.3.150.0900.05314.80
5.3.140.0800.04714.67
5.3.130.0800.05014.55
5.3.120.0730.05314.68
5.3.110.0970.03714.59
5.3.100.0930.04714.05
5.3.90.0870.05314.25
5.3.80.0930.05014.14
5.3.70.0830.06014.16
5.3.60.0730.05714.08
5.3.50.0800.06313.96
5.3.40.0800.04713.99
5.3.30.0770.06013.97
5.3.20.0730.05013.74
5.3.10.0770.04713.72
5.3.00.0770.04713.77
5.2.170.0600.04311.26
5.2.160.0530.05311.27
5.2.150.0630.04711.19
5.2.140.0630.04011.26
5.2.130.0670.03711.24
5.2.120.0700.03311.17
5.2.110.0600.04011.17
5.2.100.0700.03311.23
5.2.90.0670.03711.25
5.2.80.0600.04311.24
5.2.70.0700.03711.14
5.2.60.0700.03311.10
5.2.50.0600.04311.04
5.2.40.0570.03311.02
5.2.30.0530.03711.02
5.2.20.0470.05011.01
5.2.10.0530.04010.98
5.2.00.0430.04710.84
5.1.60.0500.04010.04
5.1.50.0530.03010.14
5.1.40.0470.03710.07
5.1.30.0570.03310.33
5.1.20.0500.03710.31
5.1.10.0500.03710.22
5.1.00.0500.03710.22
5.0.50.0300.0278.70
5.0.40.0230.0338.56
5.0.30.0300.0378.43
5.0.20.0230.0308.29
5.0.10.0170.0378.21
5.0.00.0230.0438.26
4.4.90.0200.0275.87
4.4.80.0270.0205.91
4.4.70.0300.0205.81
4.4.60.0330.0205.80
4.4.50.0300.0205.82
4.4.40.0300.0375.94
4.4.30.0270.0275.89
4.4.20.0300.0205.88
4.4.10.0330.0235.96
4.4.00.0230.0375.91
4.3.110.0270.0205.80
4.3.100.0300.0205.89
4.3.90.0270.0275.79
4.3.80.0300.0375.81
4.3.70.0330.0175.79
4.3.60.0300.0175.87
4.3.50.0270.0205.79
4.3.40.0200.0405.77
4.3.30.0130.0274.63
4.3.20.0170.0204.64
4.3.10.0100.0234.52
4.3.00.0030.0278.73

preferences:
50.25 ms | 400 KiB | 5 Q