3v4l.org

run code in 300+ PHP versions simultaneously
<?php $hotels = [ ['Mercury', 4, 8.7, 15212], ['Novotel', 4, 8.5, 18147], ['Sheraton', 5, 8.7, 19342], ['Redison', 5, 8.7, 22841], ['Polonia', 4, 9.1, 23109], ['Merc Varsh', 4, 8.7, 24431], ['Sofitel', 5, 9.0, 25719], ['Varah Mar', 5, 8.7, 26268], ['Hotel', 5, 8.9, 28004], ['Hotel dristol', 5, 9.2, 29843], ]; $totalHotelsNumber = 2; $starCoef = 0.2; $ratingCoef = 2000; for ( $i=0; $i<count($hotels); $i++ ) { $hotels[$i][4] = 0; } for ( $i=0; $i<count($hotels); $i++ ) { for ( $j=$i+1; $j<count($hotels); $j++ ) { echo 'Comparing '.$hotels[$i][0].' and '.$hotels[$j][0].'...'."\r\n"; $starDifference = $hotels[$i][1]-$hotels[$j][1]; $ratingToCompensate = $starDifference*$starCoef; $rating = $hotels[$i][2]+$ratingToCompensate; $ratingDifference = ($rating-$hotels[$j][2])*10; $priceToCompensate = $ratingDifference*$ratingCoef; $price = round($hotels[$i][3]-$priceToCompensate); echo $price.' VS '.$hotels[$j][3]."\r\n"; if ( $price < $hotels[$j][3] ) { echo $hotels[$i][0].' wins!'."\r\n"; $hotels[$i][4]++; } else { echo $hotels[$j][0].' wins!'."\r\n"; $hotels[$j][4]++; } echo "\r\n".'----------'."\r\n"; } } usort($hotels, function($hotelA, $hotelB){ return $hotelB[4]-$hotelA[4]; }); echo "\r\n".'----------'."\r\n"; echo 'Top:'."\r\n\r\n"; for ( $i=0; $i<count($hotels); $i++ ) { echo $hotels[$i][0].': '.$hotels[$i][4]."\r\n"; } echo "\r\n".'----------'."\r\n"; echo 'Finalists:'."\r\n\r\n"; for ( $i=0; $i<=1; $i++ ) { echo $hotels[$i][0]."\r\n"; }

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.0070.01116.63
8.3.50.0100.01022.01
8.3.40.0070.00718.99
8.3.30.0100.00719.17
8.3.20.0080.00020.28
8.3.10.0080.00023.74
8.3.00.0060.00319.51
8.2.180.0120.00618.14
8.2.170.0080.00822.96
8.2.160.0080.00620.34
8.2.150.0060.00324.18
8.2.140.0040.00424.66
8.2.130.0030.00626.16
8.2.120.0040.00422.25
8.2.110.0100.00022.19
8.2.100.0090.00317.91
8.2.90.0040.00419.39
8.2.80.0050.00317.97
8.2.70.0030.00617.63
8.2.60.0040.00418.05
8.2.50.0060.00318.07
8.2.40.0040.00418.28
8.2.30.0000.00818.16
8.2.20.0040.00417.89
8.2.10.0080.00019.96
8.2.00.0000.01017.86
8.1.280.0210.00025.92
8.1.270.0030.00522.31
8.1.260.0030.00526.35
8.1.250.0000.00828.09
8.1.240.0030.00623.97
8.1.230.0110.00020.91
8.1.220.0000.00817.74
8.1.210.0040.00418.77
8.1.200.0110.00017.38
8.1.190.0000.00817.78
8.1.180.0000.00818.10
8.1.170.0100.00018.71
8.1.160.0040.00422.05
8.1.150.0000.00718.83
8.1.140.0070.00017.58
8.1.130.0000.00817.91
8.1.120.0040.00417.63
8.1.110.0040.00417.64
8.1.100.0000.00717.59
8.1.90.0040.00417.56
8.1.80.0000.00717.50
8.1.70.0040.00417.55
8.1.60.0030.00517.70
8.1.50.0030.00517.62
8.1.40.0080.00017.65
8.1.30.0060.00317.73
8.1.20.0060.00317.71
8.1.10.0000.00717.62
8.1.00.0040.00417.51
8.0.300.0040.00418.77
8.0.290.0090.00017.30
8.0.280.0040.00418.57
8.0.270.0050.00217.34
8.0.260.0000.00717.40
8.0.250.0050.00317.09
8.0.240.0000.00717.08
8.0.230.0000.00717.08
8.0.220.0000.00816.91
8.0.210.0000.00817.08
8.0.200.0000.00817.07
8.0.190.0040.00417.05
8.0.180.0040.00416.93
8.0.170.0050.00317.07
8.0.160.0050.00316.91
8.0.150.0000.00716.86
8.0.140.0070.00016.87
8.0.130.0030.00313.49
8.0.120.0000.00816.96
8.0.110.0080.00017.02
8.0.100.0050.00317.13
8.0.90.0040.00416.91
8.0.80.0030.01316.98
8.0.70.0000.00716.96
8.0.60.0040.00416.96
8.0.50.0000.00816.91
8.0.30.0150.00917.02
8.0.20.0190.00117.40
8.0.10.0030.00617.18
8.0.00.0130.00616.95
7.4.330.0020.00215.00
7.4.320.0040.00416.72
7.4.300.0000.00716.58
7.4.290.0000.00716.64
7.4.280.0070.00016.65
7.4.270.0040.00316.71
7.4.260.0000.00716.70
7.4.250.0000.00716.73
7.4.240.0040.00416.65
7.4.230.0030.00316.71
7.4.220.0170.00416.69
7.4.210.0040.01316.61
7.4.200.0050.00316.55
7.4.190.0040.00416.77
7.4.160.0130.00616.68
7.4.150.0150.00617.40
7.4.140.0050.01517.86
7.4.130.0090.01016.69
7.4.120.0100.00816.74
7.4.110.0140.00416.58
7.4.100.0100.01016.70
7.4.90.0090.01316.54
7.4.80.0030.02019.39
7.4.70.0090.00916.68
7.4.60.0080.01116.57
7.4.50.0090.00016.29
7.4.40.0030.01022.77
7.4.30.0100.00716.55
7.4.00.0090.00715.03
7.3.330.0030.00313.28
7.3.320.0050.00013.47
7.3.310.0040.00416.37
7.3.300.0040.00416.42
7.3.290.0060.01516.45
7.3.280.0070.01416.46
7.3.270.0070.01017.40
7.3.260.0140.00316.43
7.3.250.0110.00916.53
7.3.240.0140.00716.80
7.3.230.0070.01116.54
7.3.210.0100.01016.73
7.3.200.0130.01319.39
7.3.190.0060.01316.43
7.3.180.0180.00016.41
7.3.170.0100.00616.64
7.3.160.0130.00716.60
7.3.120.0060.01114.68
7.3.110.0090.00914.83
7.3.100.0100.00014.91
7.3.90.0030.01215.05
7.3.80.0080.00615.14
7.3.70.0030.00614.93
7.3.60.0030.00914.83
7.3.50.0070.00714.79
7.3.40.0090.00314.93
7.3.30.0140.00314.74
7.3.20.0100.00016.82
7.3.10.0070.00416.44
7.3.00.0060.01016.62
7.2.330.0130.00616.87
7.2.320.0080.02116.93
7.2.310.0120.01216.86
7.2.300.0060.01216.98
7.2.290.0110.01416.93
7.2.250.0050.00515.00
7.2.240.0060.01314.88
7.2.230.0060.00914.95
7.2.220.0050.00515.27
7.2.210.0000.01015.11
7.2.200.0000.01415.12
7.2.190.0070.00715.09
7.2.180.0030.01015.19
7.2.170.0080.00615.24
7.2.130.0090.00316.82
7.2.120.0060.00917.02
7.2.110.0030.00617.01
7.2.100.0090.00617.07
7.2.90.0100.01016.99
7.2.80.0120.00316.62
7.2.70.0100.00716.55
7.2.60.0070.01017.07
7.2.50.0000.01616.98
7.2.40.0080.00417.05
7.2.30.0000.01416.63
7.2.20.0110.00416.80
7.2.10.0030.00616.85
7.2.00.0050.01018.21
7.1.330.0100.00315.63
7.1.320.0060.00915.68
7.1.310.0060.00615.59
7.1.300.0090.00615.77
7.1.290.0060.00615.59
7.1.280.0110.00715.66
7.1.270.0090.00615.51
7.1.260.0070.00715.92
7.1.250.0060.00915.77
7.1.100.0030.00918.14
7.1.70.0000.01017.22
7.1.60.0110.00719.33
7.1.50.0070.01616.78
7.1.00.0000.08022.34
7.0.200.0040.00814.66
7.0.140.0000.07722.18
7.0.60.0300.07720.00
7.0.50.0030.04317.77
7.0.40.0170.07720.23
7.0.30.0230.03720.07
7.0.20.0230.08320.12
7.0.10.0130.05020.33
7.0.00.0070.06720.06
5.6.280.0070.07020.93
5.6.210.0100.06320.50
5.6.200.0000.07018.16
5.6.190.0030.07020.61
5.6.180.0270.05020.54
5.6.170.0270.05720.59
5.6.160.0030.05320.63
5.6.150.0070.06718.15
5.6.140.0130.07318.18
5.6.130.0100.06718.19
5.6.120.0070.04721.02
5.6.110.0130.07720.91
5.6.100.0130.08321.00
5.6.90.0130.07721.12
5.6.80.0000.04020.55
5.5.350.4300.04020.40
5.5.340.0000.08318.05
5.5.330.0030.05320.35
5.5.320.0230.04320.44
5.5.310.0270.07720.25
5.5.300.0000.05717.96
5.5.290.0070.04017.97
5.5.280.0100.08020.89
5.5.270.0170.05020.89
5.5.260.0070.06020.79
5.5.250.0100.08020.60
5.5.240.0070.03320.30
5.4.450.3700.03719.30
5.4.440.0030.04319.47
5.4.430.1370.05019.62
5.4.420.3870.03719.46
5.4.410.4000.04019.47
5.4.400.4430.04319.22
5.4.390.3800.04019.18
5.4.380.3500.04019.10
5.4.370.4500.03019.27
5.4.360.4430.04718.99
5.4.350.3770.03019.24
5.4.340.4070.04018.93
5.4.320.4130.04019.27
5.4.310.4230.03719.07
5.4.300.4330.04019.06
5.4.290.3700.03019.24
5.4.280.4200.04719.30
5.4.270.4500.03319.30
5.4.260.4070.03019.00
5.4.250.3730.04019.23
5.4.240.0100.05719.29
5.4.230.0030.05719.06
5.4.220.3900.03719.29
5.4.210.3530.04319.21
5.4.200.3530.03719.16
5.4.190.4030.04318.94
5.4.180.4530.04019.11
5.4.170.4530.04019.09
5.4.160.4170.04319.25
5.4.150.3730.03719.19
5.4.140.0170.03316.54
5.4.130.2800.03316.52
5.4.120.4400.04016.43
5.4.110.4170.03316.51
5.4.100.3830.02716.55
5.4.90.3570.03316.37
5.4.80.4500.04016.46
5.4.70.4730.03316.51
5.4.60.4530.03716.34
5.4.50.4470.02716.52
5.4.40.4600.04016.63
5.4.30.4300.03316.54
5.4.20.4530.03016.52
5.4.10.4500.04016.24
5.4.00.4070.04315.88
5.3.290.4170.04014.60
5.3.280.4300.03314.41
5.3.270.4600.03314.71
5.3.260.4330.04314.56
5.3.250.0100.07014.53
5.3.240.0070.06714.54
5.3.230.4130.03714.53
5.3.220.4500.04314.50
5.3.210.3530.04014.50
5.3.200.3530.03714.35
5.3.190.4370.03714.54
5.3.180.3970.03714.53
5.3.170.4100.04314.49
5.3.160.4530.03314.49
5.3.150.4300.03314.49
5.3.140.4730.03714.48
5.3.130.4200.04014.48
5.3.120.4600.03714.52
5.3.110.4400.04314.53
5.3.100.3730.03713.83
5.3.90.4370.03014.00
5.3.80.3770.02313.95
5.3.70.3370.04013.80
5.3.60.3570.03713.93
5.3.50.3570.03713.92
5.3.40.3530.03713.78
5.3.30.3630.03013.74
5.3.20.3700.03313.48
5.3.10.3670.02713.44
5.3.00.3430.03013.58
5.2.170.3100.02711.15
5.2.160.3030.02711.22
5.2.150.3000.02710.96
5.2.140.3370.03710.99
5.2.130.3230.02311.26
5.2.120.3000.03011.01
5.2.110.3100.02311.00
5.2.100.2700.03011.00
5.2.90.3000.02311.04
5.2.80.2870.03011.08
5.2.70.3130.03010.92
5.2.60.3270.02710.93
5.2.50.3130.02710.91
5.2.40.2470.02010.85
5.2.30.2370.03310.96
5.2.20.2600.03010.90
5.2.10.3070.03010.87
5.2.00.3200.03010.71
5.1.60.3170.03010.01
5.1.50.2930.0309.94
5.1.40.2870.0239.99
5.1.30.3030.02710.19
5.1.20.2670.02310.34
5.1.10.2630.02310.06
5.1.00.2670.02710.02
5.0.50.1470.0238.52
5.0.40.1530.0208.47
5.0.30.1470.0338.13
5.0.20.1900.0208.24
5.0.10.1800.0238.28
5.0.00.1430.0308.21
4.4.90.1370.0208.10
4.4.80.1430.0138.10
4.4.70.1430.0178.10
4.4.60.1570.0138.10
4.4.50.1500.0208.10
4.4.40.1770.0278.10
4.4.30.1770.0178.10
4.4.20.1370.0178.10
4.4.10.1230.0178.10
4.4.00.1200.0278.10
4.3.110.1200.0178.10
4.3.100.1500.0208.10
4.3.90.1300.0178.10
4.3.80.1400.0278.10
4.3.70.1530.0138.10
4.3.60.1500.0138.10
4.3.50.1400.0138.10
4.3.40.1600.0278.10
4.3.30.0770.0208.10
4.3.20.0930.0238.10
4.3.10.0970.0238.10
4.3.00.1000.0178.10

preferences:
40.86 ms | 401 KiB | 5 Q