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.0090.00618.32
8.3.50.0050.01122.05
8.3.40.0150.00618.63
8.3.30.0040.01119.21
8.3.20.0040.00420.34
8.3.10.0030.00521.92
8.3.00.0050.00317.93
8.2.180.0130.00316.75
8.2.170.0130.00322.96
8.2.160.0030.01020.52
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0070.00026.16
8.2.120.0040.00420.95
8.2.110.0030.00720.99
8.2.100.0040.00817.97
8.2.90.0050.00317.91
8.2.80.0060.00317.97
8.2.70.0050.00317.63
8.2.60.0000.01317.66
8.2.50.0040.00418.07
8.2.40.0050.00517.80
8.2.30.0000.00718.08
8.2.20.0000.00817.68
8.2.10.0050.00217.96
8.2.00.0000.00917.78
8.1.280.0110.00425.92
8.1.270.0040.00423.78
8.1.260.0050.00226.35
8.1.250.0040.00428.09
8.1.240.0040.00422.52
8.1.230.0110.00020.85
8.1.220.0050.00317.74
8.1.210.0030.00618.87
8.1.200.0060.00617.23
8.1.190.0040.00417.10
8.1.180.0080.00018.10
8.1.170.0060.00618.50
8.1.160.0000.00721.97
8.1.150.0040.00418.71
8.1.140.0080.00317.41
8.1.130.0000.00717.89
8.1.120.0000.00717.40
8.1.110.0040.00417.34
8.1.100.0040.00417.41
8.1.90.0030.00517.39
8.1.80.0000.00817.38
8.1.70.0000.00717.32
8.1.60.0080.00217.57
8.1.50.0030.00617.55
8.1.40.0000.00817.57
8.1.30.0090.00017.50
8.1.20.0000.00917.68
8.1.10.0050.00217.55
8.1.00.0050.00317.42
8.0.300.0040.00419.89
8.0.290.0060.00316.63
8.0.280.0070.00018.50
8.0.270.0000.00717.29
8.0.260.0000.00617.28
8.0.250.0030.00417.04
8.0.240.0030.00317.00
8.0.230.0040.00416.83
8.0.220.0000.00716.77
8.0.210.0000.00716.82
8.0.200.0030.00316.98
8.0.190.0000.00816.78
8.0.180.0040.00416.77
8.0.170.0030.00516.89
8.0.160.0000.00716.73
8.0.150.0000.01016.87
8.0.140.0050.00216.81
8.0.130.0000.00513.25
8.0.120.0040.00416.70
8.0.110.0020.00516.76
8.0.100.0040.00416.72
8.0.90.0000.00716.80
8.0.80.0090.01216.90
8.0.70.0080.00016.74
8.0.60.0040.00416.79
8.0.50.0000.00816.85
8.0.30.0100.00917.16
8.0.20.0140.00617.40
8.0.10.0040.00417.01
8.0.00.0070.01216.77
7.4.330.0020.00215.07
7.4.320.0030.00316.52
7.4.300.0060.00016.62
7.4.290.0070.00016.63
7.4.280.0040.00416.41
7.4.270.0040.00316.54
7.4.260.0040.00416.52
7.4.250.0040.00416.41
7.4.240.0020.00516.63
7.4.230.0030.00316.27
7.4.220.0070.01316.57
7.4.210.0080.00616.46
7.4.200.0030.00316.66
7.4.160.0080.00816.34
7.4.150.0070.01017.40
7.4.140.0150.00517.86
7.4.130.0090.00916.51
7.4.120.0110.00716.57
7.4.110.0060.01016.51
7.4.100.0060.01216.58
7.4.90.0160.00716.56
7.4.80.0170.00319.39
7.4.70.0120.00916.40
7.4.60.0030.01316.72
7.4.50.0040.00416.63
7.4.40.0080.00916.61
7.4.30.0100.00716.60
7.4.00.0070.00714.96
7.3.330.0000.00613.22
7.3.320.0030.00313.46
7.3.310.0000.00716.42
7.3.300.0030.00316.35
7.3.290.0000.01716.43
7.3.280.0110.00516.40
7.3.270.0070.01017.40
7.3.260.0140.00316.40
7.3.250.0080.01216.47
7.3.240.0100.00716.55
7.3.230.0040.01416.39
7.3.210.0120.00416.32
7.3.200.0130.00619.39
7.3.190.0130.00416.41
7.3.180.0070.01016.38
7.3.170.0110.00416.33
7.3.160.0130.00516.54
7.3.120.0000.01814.86
7.3.00.0050.00816.27
7.2.330.0170.00016.84
7.2.320.0090.00916.75
7.2.310.0070.01416.80
7.2.300.0090.00916.72
7.2.290.0160.00616.80
7.2.130.0110.00416.88
7.2.120.0070.00716.42
7.2.110.0150.01016.59
7.2.100.0060.00916.92
7.2.90.0110.00416.92
7.2.80.0070.01016.82
7.2.70.0140.00316.54
7.2.60.0040.01216.71
7.2.50.0130.00316.64
7.2.40.0030.01316.72
7.2.30.0030.01116.99
7.2.20.0090.00616.68
7.2.10.0070.00316.88
7.2.00.0060.00916.77
7.1.250.0130.00015.68
7.1.240.0130.00315.66
7.1.230.0060.00615.61
7.1.220.0060.01015.58
7.1.210.0060.00315.47
7.1.200.0050.00815.58
7.1.190.0040.00815.79
7.1.180.0070.00615.61
7.1.170.0070.01015.98
7.1.160.0070.01015.78
7.1.150.0070.01015.85
7.1.140.0070.00715.80
7.1.130.0060.00915.48
7.1.120.0100.00315.61
7.1.110.0060.00315.75
7.1.100.0090.00615.75
7.1.90.0030.01315.66
7.1.80.0000.01115.86
7.1.70.0060.00416.40
7.1.60.0060.01317.36
7.1.50.0030.00916.27
7.1.40.0060.00615.83
7.1.30.0140.00015.80
7.1.20.0050.00515.62
7.1.10.0060.00915.48
7.1.00.0050.04319.04
7.0.330.0040.01115.27
7.0.320.0000.01415.45
7.0.310.0070.00715.26
7.0.300.0150.00015.25
7.0.290.0080.00015.34
7.0.280.0070.00715.50
7.0.270.0070.00614.96
7.0.260.0030.00615.10
7.0.250.0040.01115.25
7.0.240.0000.01415.29
7.0.230.0090.00915.36
7.0.220.0000.01315.49
7.0.210.0070.01015.30
7.0.200.0030.00716.14
7.0.190.0060.00615.30
7.0.180.0060.00915.17
7.0.170.0030.00615.14
7.0.160.0100.00315.38
7.0.150.0030.01015.45
7.0.140.0030.04118.76
7.0.130.0080.00515.54
7.0.120.0070.00715.32
7.0.110.0060.00615.45
7.0.100.0060.00615.41
7.0.90.0140.00015.48
7.0.80.0100.00315.36
7.0.70.0060.00615.19
7.0.60.0080.04517.47
7.0.50.0030.02516.54
7.0.40.0110.04216.70
7.0.30.0130.02316.74
7.0.20.0190.04016.77
7.0.10.0060.04116.66
7.0.00.0080.04716.67
5.6.380.0000.01614.57
5.6.370.0120.00314.05
5.6.360.0060.00314.59
5.6.350.0000.00914.42
5.6.340.0050.00514.37
5.6.330.0030.01014.51
5.6.320.0060.00614.62
5.6.310.0060.00614.06
5.6.300.0030.01314.54
5.6.290.0070.00714.21
5.6.280.0000.04417.67
5.6.270.0040.01114.05
5.6.260.0080.00614.25
5.6.250.0040.01114.34
5.6.240.0060.00314.46
5.6.230.0050.00314.30
5.6.220.0060.00314.54
5.6.210.0030.02317.51
5.6.200.0070.04716.17
5.6.190.0100.04217.34
5.6.180.1910.02617.31
5.6.170.0120.02817.33
5.6.160.0070.04717.55
5.6.150.0020.02416.29
5.6.140.0020.02616.35
5.6.130.0040.04916.16
5.6.120.0050.02817.66
5.6.110.0080.04217.63
5.6.100.0080.02717.58
5.6.90.0120.03717.54
5.6.80.0050.04317.21
5.6.70.2280.02317.28
5.6.60.0040.00714.26
5.6.50.0090.00314.12
5.6.40.0100.00314.19
5.6.30.0030.01014.25
5.6.20.0170.00014.09
5.6.10.0060.00314.15
5.6.00.0100.00014.25
5.5.380.0030.00611.18
5.5.370.0030.00611.20
5.5.360.0000.01111.46
5.5.350.0170.03815.86
5.5.340.0030.02914.58
5.5.330.0030.03515.79
5.5.320.1750.02215.80
5.5.310.0190.02715.86
5.5.300.0050.04314.72
5.5.290.0060.02114.70
5.5.280.0070.03616.03
5.5.270.0120.03816.14
5.5.260.0070.02116.00
5.5.250.0090.04015.98
5.5.240.0120.03815.74
5.5.230.0000.00711.18
5.5.220.0070.00411.18
5.5.210.0080.00011.29
5.5.200.0040.00411.30
5.5.190.0090.00011.29
5.5.180.0030.00511.18
5.5.170.0070.00711.39
5.5.160.0070.00311.27
5.5.150.0040.00811.18
5.5.140.0100.00011.18
5.5.130.0040.00711.31
5.5.120.0030.00311.29
5.5.110.0070.00011.18
5.5.100.0030.00311.33
5.5.90.0080.00011.18
5.5.80.0030.00311.18
5.5.70.0040.00711.22
5.5.60.0000.00611.18
5.5.50.0060.00311.31
5.5.40.0030.00711.18
5.5.30.0070.00411.18
5.5.20.0030.00611.18
5.5.10.0060.00311.21
5.5.00.0030.00311.18
5.4.450.0180.02515.33
5.4.440.0550.01915.19
5.4.430.0300.02415.33
5.4.420.0480.02315.26
5.4.410.0230.02115.18
5.4.400.0300.02015.25
5.4.390.0250.02215.17
5.4.380.0220.02714.90
5.4.370.0190.03215.00
5.4.360.0220.02514.83
5.4.350.0220.02714.99
5.4.340.0200.02714.96
5.4.330.0000.00811.18
5.4.320.0060.02411.84
5.4.310.0070.02011.84
5.4.300.0050.02411.84
5.4.290.0040.02111.84
5.4.280.0070.02111.79
5.4.270.0020.02311.79
5.4.260.0060.02111.79
5.4.250.0040.02411.79
5.4.240.0040.02111.79
5.4.230.0050.02111.79
5.4.220.0040.02411.79
5.4.210.0040.02211.79
5.4.200.0060.02111.79
5.4.190.0020.02511.79
5.4.180.0040.02311.79
5.4.170.0030.03211.79
5.4.160.0070.02311.79
5.4.150.0060.02511.79
5.4.140.0030.03111.63
5.4.130.0060.02611.63
5.4.120.0050.02211.60
5.4.110.0040.02411.60
5.4.100.0070.02011.60
5.4.90.0110.01511.60
5.4.80.0060.02411.60
5.4.70.0040.02111.60
5.4.60.0030.02111.60
5.4.50.0050.02411.60
5.4.40.0070.02011.59
5.4.30.0050.02211.59
5.4.20.0040.02211.59
5.4.10.0070.02011.59
5.4.00.0070.02111.33
5.3.290.0080.02011.99
5.3.280.0080.02411.94
5.3.270.0030.02411.95
5.3.260.0040.02411.95
5.3.250.0050.02411.95
5.3.240.0050.02111.95
5.3.230.0060.02311.94
5.3.220.0090.02211.93
5.3.210.0070.02311.93
5.3.200.0030.02411.93
5.3.190.0040.02411.93
5.3.180.0090.01911.92
5.3.170.0090.02111.92
5.3.160.0050.02411.92
5.3.150.0050.02211.92
5.3.140.0070.02511.92
5.3.130.0040.02711.92
5.3.120.0040.02511.92
5.3.110.0020.02411.92
5.3.100.0070.02111.65
5.3.90.0060.02111.64
5.3.80.0050.02411.64
5.3.70.0040.02311.64
5.3.60.0060.02011.63
5.3.50.0040.02111.60
5.3.40.0020.02511.60
5.3.30.0060.02011.58
5.3.20.0050.02011.47
5.3.10.0060.01911.46
5.3.00.0030.02311.45
5.2.170.0070.01510.20
5.2.160.0020.01710.20
5.2.150.0040.01610.20
5.2.140.0040.01810.20
5.2.130.0010.02010.18
5.2.120.0040.01810.18
5.2.110.0020.01810.18
5.2.100.0030.01710.18
5.2.90.0030.01710.18
5.2.80.0030.01810.18
5.2.70.0080.01510.18
5.2.60.0070.01810.15
5.2.50.0030.01710.14
5.2.40.0050.01610.13
5.2.30.0040.01710.12
5.2.20.0050.01710.11
5.2.10.0030.01710.06
5.2.00.0070.01410.00
5.1.60.0010.0169.64
5.1.50.0040.0189.63
5.1.40.0020.0179.63
5.1.30.0030.0159.80
5.1.20.0040.0149.81
5.1.10.0050.0149.67
5.1.00.0050.0169.67
5.0.50.0040.0128.91
5.0.40.0050.0108.84
5.0.30.0050.0158.75
5.0.20.0030.0128.73
5.0.10.0060.0098.72
5.0.00.0040.0188.72
4.4.90.0010.0107.98
4.4.80.0040.0117.97
4.4.70.0020.0097.97
4.4.60.0010.0117.97
4.4.50.0020.0107.97
4.4.40.0030.0187.94
4.4.30.0010.0127.97
4.4.20.0020.0118.01
4.4.10.0040.0128.01
4.4.00.0020.0157.97
4.3.110.0020.0127.92
4.3.100.0020.0137.92
4.3.90.0020.0127.91
4.3.80.0020.0157.88
4.3.70.0020.0097.90
4.3.60.0020.0097.90
4.3.50.0040.0097.90
4.3.40.0020.0167.86
4.3.30.0020.0107.24
4.3.20.0030.0097.23
4.3.10.0040.0077.21
4.3.00.0040.00913.23

preferences:
34.05 ms | 401 KiB | 5 Q