3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Prices { private $priceList = array( /* HR EN DE FR IT ES */ /* HR */ '0 100 100 100 100 100', /* EN */ '80 0 120 120 120 120', /* DE */ '80 120 0 120 120 120', /* FR */ '80 120 120 0 120 120', /* IT */ '80 120 120 120 0 120', /* ES */ '80 120 120 120 120 0', ); private $coef = 1; private $languages = array('HR', 'EN', 'DE', 'FR', 'IT', 'ES'); // Must be the same order as in $priceList public function getRate($source, $target) { $this->verifyPriceList(); $sourceKey = array_search($source, $this->priceList); $targetKey = array_search($target, $this->priceList); return intval(explode('\t', $this->priceList[$sourceKey])[$targetKey]); } /* $priceList must not contain spaces */ private function verifyPriceList() { if (strstr(implode('', $this->priceList), ' ') !== FALSE) throw Exception('Price list contains spaces! Location: class.Prices.php'); } } $p = new Prices(); echo $p->getRate('HR', 'EN'); ?>

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.0110.00418.56
8.3.50.0140.00622.11
8.3.40.0150.00618.84
8.3.30.0110.00419.03
8.3.20.0040.00420.21
8.3.10.0000.00821.73
8.3.00.0040.00417.93
8.2.180.0150.00016.88
8.2.170.0110.00322.96
8.2.160.0120.00318.91
8.2.150.0080.00024.18
8.2.140.0040.00424.66
8.2.130.0070.00026.16
8.2.120.0040.00420.86
8.2.110.0030.00622.31
8.2.100.0000.01219.57
8.2.90.0080.00019.27
8.2.80.0040.00417.97
8.2.70.0040.00417.50
8.2.60.0060.00317.93
8.2.50.0060.00318.07
8.2.40.0090.00018.03
8.2.30.0000.00718.16
8.2.20.0040.00417.83
8.2.10.0000.00718.08
8.2.00.0040.00417.63
8.1.280.0090.00625.92
8.1.270.0040.00423.90
8.1.260.0070.00026.35
8.1.250.0040.00428.09
8.1.240.0060.00324.02
8.1.230.0080.00319.05
8.1.220.0000.00817.79
8.1.210.0050.00318.77
8.1.200.0100.00017.22
8.1.190.0040.00417.10
8.1.180.0040.00418.10
8.1.170.0060.00320.31
8.1.160.0000.00721.95
8.1.150.0040.00418.88
8.1.140.0070.00417.41
8.1.130.0000.00817.72
8.1.120.0040.00417.38
8.1.110.0040.00417.45
8.1.100.0000.00817.48
8.1.90.0000.00717.42
8.1.80.0000.00717.38
8.1.70.0030.00317.38
8.1.60.0030.00917.50
8.1.50.0040.00417.45
8.1.40.0030.00617.50
8.1.30.0040.00417.54
8.1.20.0080.00017.64
8.1.10.0030.00517.61
8.1.00.0040.00417.49
8.0.300.0040.00418.77
8.0.290.0000.00916.63
8.0.280.0000.00718.46
8.0.270.0030.00317.23
8.0.260.0030.00317.31
8.0.250.0040.00417.02
8.0.240.0000.00717.01
8.0.230.0050.00316.90
8.0.220.0030.00316.85
8.0.210.0030.00316.89
8.0.200.0060.00016.87
8.0.190.0070.00016.98
8.0.180.0050.00316.83
8.0.170.0040.00416.87
8.0.160.0030.00316.88
8.0.150.0070.00316.80
8.0.140.0000.00816.87
8.0.130.0030.00313.23
8.0.120.0030.00516.82
8.0.110.0040.00416.77
8.0.100.0000.00816.72
8.0.90.0080.00016.89
8.0.80.0070.01416.80
8.0.70.0040.00416.67
8.0.60.0020.00516.63
8.0.50.0040.00416.82
8.0.30.0080.01117.04
8.0.20.0100.01217.40
8.0.10.0040.00416.89
8.0.00.0090.00816.89
7.4.330.0020.00215.00
7.4.320.0030.00316.57
7.4.300.0060.00016.57
7.4.290.0020.00516.54
7.4.280.0090.00016.50
7.4.270.0030.00316.62
7.4.260.0030.00316.60
7.4.250.0050.00316.61
7.4.240.0050.00216.54
7.4.230.0080.00016.68
7.4.220.0070.01116.58
7.4.210.0090.00616.64
7.4.200.0000.00716.38
7.4.160.0120.00316.67
7.4.150.0030.01417.40
7.4.140.0140.00417.86
7.4.130.0100.00616.50
7.4.120.0070.01116.60
7.4.110.0100.00716.41
7.4.100.0060.01216.36
7.4.90.0150.00316.32
7.4.80.0090.00919.39
7.4.70.0160.00516.51
7.4.60.0070.01016.50
7.4.50.0040.00416.45
7.4.40.0080.00916.57
7.4.30.0130.00316.46
7.4.00.0070.01014.96
7.3.330.0000.00613.40
7.3.320.0000.00613.38
7.3.310.0000.00716.42
7.3.300.0030.00316.40
7.3.290.0040.01116.41
7.3.280.0150.00516.39
7.3.270.0100.00717.40
7.3.260.0120.01116.74
7.3.250.0100.00716.42
7.3.240.0140.00416.58
7.3.230.0130.00616.59
7.3.210.0030.01516.60
7.3.200.0150.00519.39
7.3.190.0070.01116.26
7.3.180.0060.00916.48
7.3.170.0030.01216.34
7.3.160.0080.00916.50
7.3.120.0070.00715.04
7.2.330.0070.01516.78
7.2.320.0140.00316.70
7.2.310.0210.00416.74
7.2.300.0100.00616.57
7.2.290.0070.01416.41
7.2.60.0040.00716.91
7.1.200.0040.00715.92
7.1.70.0040.00417.38
7.1.60.0040.01819.11
7.1.50.0030.01916.95
7.1.00.0070.07322.25
7.0.200.0040.00416.77
7.0.140.0030.07321.96
7.0.60.0030.07020.09
7.0.50.0030.04017.83
7.0.40.0000.07320.13
7.0.30.0200.06020.26
7.0.20.0330.07320.10
7.0.10.0230.04720.09
7.0.00.0130.07320.20
5.6.280.0100.06721.11
5.6.210.0070.08020.76
5.6.200.0100.07718.24
5.6.190.0100.03720.57
5.6.180.0030.04320.39
5.6.170.0230.04020.47
5.6.160.0070.04320.56
5.6.150.0030.08318.21
5.6.140.0130.03318.20
5.6.130.0000.07018.12
5.6.120.0070.03721.05
5.6.110.0170.07321.15
5.6.100.0030.08721.01
5.6.90.0100.08021.11
5.6.80.0100.05020.55
5.6.70.3630.03720.53
5.5.350.0030.08320.44
5.5.340.0100.06018.02
5.5.330.0130.07720.32
5.5.320.0400.07320.50
5.5.310.0230.05020.30
5.5.300.0170.07018.09
5.5.290.0070.04718.10
5.5.280.0030.05320.78
5.5.270.0030.08720.78
5.5.260.0100.07320.66
5.5.250.0070.08020.70
5.5.240.0030.04720.19
5.4.450.4770.03719.39
5.4.440.2970.04319.48
5.4.430.3730.04719.39
5.4.420.3770.04019.46
5.4.410.3470.03719.28
5.4.400.3600.04318.99
5.4.390.3400.04018.86
5.4.380.3370.03318.99
5.4.370.3230.04019.07
5.4.360.3530.04318.98
5.4.350.3230.03718.96
5.4.340.3370.03718.98
5.4.320.3230.04018.99
5.4.310.3300.03318.92
5.4.300.3370.04019.07
5.4.290.3070.03718.88
5.4.280.3730.04019.19
5.4.270.3370.03719.07
5.4.260.4230.03018.98
5.4.250.3170.04318.97
5.4.240.3670.05018.97
5.4.230.3370.04019.12
5.4.220.3300.04019.11
5.4.210.3670.03319.05
5.4.200.3630.04018.95
5.4.190.3300.04318.91
5.4.180.3270.03719.14
5.4.170.3400.04019.04
5.4.160.3370.03318.96
5.4.150.3530.03319.05
5.4.140.3530.03716.31
5.4.130.2970.03016.46
5.4.120.3630.03316.51
5.4.110.3700.03716.20
5.4.100.3530.04016.37
5.4.90.3430.03716.58
5.4.80.3870.03316.56
5.4.70.3400.04316.35
5.4.60.3300.03016.54
5.4.50.3770.03316.24
5.4.40.3200.04016.25
5.4.30.4030.03316.16
5.4.20.3530.03316.52
5.4.10.3330.03316.52
5.4.00.3230.04015.94
5.3.290.3300.03714.68
5.3.280.3730.03314.55
5.3.270.3470.03014.73
5.3.260.3630.03714.61
5.3.250.3270.02714.61
5.3.240.3600.03314.72
5.3.230.3400.03314.50
5.3.220.3370.03314.79
5.3.210.3330.03714.61
5.3.200.3400.04014.47
5.3.190.4270.04714.65
5.3.180.4030.04014.64
5.3.170.3770.03714.66
5.3.160.4070.03714.74
5.3.150.4270.03314.54
5.3.140.3300.04014.64
5.3.130.3870.03714.54
5.3.120.3800.03714.60
5.3.110.3400.02714.52
5.3.100.3370.03014.16
5.3.90.3270.03714.05
5.3.80.3830.03314.02
5.3.70.3400.03314.16
5.3.60.3230.04014.01
5.3.50.3370.03314.03
5.3.40.3370.03014.00
5.3.30.3300.03313.82
5.3.20.3370.02713.60
5.3.10.3230.04013.57
5.3.00.3930.03713.57
5.2.170.3000.03011.08
5.2.160.2800.02711.31
5.2.150.2830.03711.11
5.2.140.2770.02311.13
5.2.130.2770.02711.04
5.2.120.3270.03011.02
5.2.110.2930.02711.22
5.2.100.2200.02711.08
5.2.90.3370.02711.02
5.2.80.3530.02711.14
5.2.70.3200.03011.26
5.2.60.2870.03011.06
5.2.50.3100.02311.03
5.2.40.2730.02710.91
5.2.30.3270.02710.88
5.2.20.2600.02711.02
5.2.10.2300.02710.84
5.2.00.2230.03010.84
5.1.60.2400.0309.89
5.1.50.2230.0239.98
5.1.40.2170.02310.07
5.1.30.2130.02710.39
5.1.20.2970.01710.44
5.1.10.2570.02710.23
5.1.00.2470.02310.23
5.0.50.1300.0278.49
5.0.40.1170.0208.35
5.0.30.1330.0338.23
5.0.20.1100.0208.16
5.0.10.1400.0208.18
5.0.00.1200.0278.09
4.4.90.1300.0177.48
4.4.80.1630.0137.48
4.4.70.1200.0137.48
4.4.60.1130.0207.48
4.4.50.1170.0177.48
4.4.40.1270.0277.48
4.4.30.1330.0237.48
4.4.20.1470.0177.48
4.4.10.1300.0237.48
4.4.00.1100.0277.48
4.3.110.0970.0177.48
4.3.100.1200.0207.48
4.3.90.1400.0177.48
4.3.80.1100.0237.48
4.3.70.1530.0107.48
4.3.60.1100.0137.48
4.3.50.1370.0177.48
4.3.40.1130.0277.48
4.3.30.0530.0177.48
4.3.20.0730.0237.48
4.3.10.0830.0237.48
4.3.00.0700.0137.48

preferences:
45.1 ms | 401 KiB | 5 Q