3v4l.org

run code in 300+ PHP versions simultaneously
<?php $hotels = [ ['Belair', 4, 8.4, 30950], ['Kamari', 4, 8.0, 39095], ['Katrin', 4, 8.4, 39514], ['sant', 4, 8.1, 40756], ['Eden', 4, 8.1, 41929], ['Amarhus', 5, 8.0, 44959], ['Esperas', 5, 8.1, 50823], ['Apolon', 4, 9.2, 54081], ['Rodos', 5, 9.0, 58968], ]; $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.70.0040.01116.75
8.3.60.0100.01016.63
8.3.50.0090.01221.15
8.3.40.0060.01318.96
8.3.30.0120.00319.20
8.3.20.0000.00820.40
8.3.10.0040.00423.47
8.3.00.0080.00019.51
8.2.180.0120.00318.48
8.2.170.0040.01822.96
8.2.160.0100.00720.37
8.2.150.0000.00824.18
8.2.140.0030.00624.66
8.2.130.0000.00926.16
8.2.120.0050.00322.44
8.2.110.0050.00522.10
8.2.100.0000.01217.84
8.2.90.0000.00919.39
8.2.80.0030.00617.97
8.2.70.0030.00717.63
8.2.60.0030.00618.05
8.2.50.0040.00418.07
8.2.40.0060.00318.28
8.2.30.0000.00818.24
8.2.20.0040.00417.80
8.2.10.0050.00318.18
8.2.00.0080.00317.86
8.1.280.0060.01325.92
8.1.270.0080.00022.19
8.1.260.0040.00426.35
8.1.250.0080.00028.09
8.1.240.0060.00323.80
8.1.230.0070.00419.28
8.1.220.0050.00317.74
8.1.210.0000.00818.77
8.1.200.0090.00017.38
8.1.190.0060.00317.55
8.1.180.0040.00418.10
8.1.170.0040.00418.57
8.1.160.0000.00722.10
8.1.150.0040.00418.73
8.1.140.0000.00817.47
8.1.130.0000.00717.80
8.1.120.0040.00417.61
8.1.110.0080.00017.62
8.1.100.0000.00717.56
8.1.90.0040.00417.51
8.1.80.0030.00517.56
8.1.70.0000.00717.48
8.1.60.0030.00617.66
8.1.50.0000.00817.56
8.1.40.0110.00017.64
8.1.30.0000.00817.71
8.1.20.0040.00417.69
8.1.10.0050.00517.70
8.1.00.0040.00417.63
8.0.300.0070.00018.77
8.0.290.0000.00717.43
8.0.280.0000.00718.57
8.0.270.0070.00017.41
8.0.260.0000.00817.36
8.0.250.0070.00017.05
8.0.240.0040.00416.93
8.0.230.0050.00317.03
8.0.220.0000.00717.00
8.0.210.0000.00717.06
8.0.200.0030.00317.05
8.0.190.0040.00417.02
8.0.180.0050.00317.05
8.0.170.0030.00517.05
8.0.160.0040.00417.09
8.0.150.0030.00516.84
8.0.140.0040.00416.86
8.0.130.0000.00613.43
8.0.120.0050.00316.85
8.0.110.0000.00816.93
8.0.100.0050.00216.94
8.0.90.0080.00017.12
8.0.80.0070.01017.02
8.0.70.0040.00417.04
8.0.60.0000.00717.07
8.0.50.0000.00816.86
8.0.30.0100.01017.18
8.0.20.0070.01317.40
8.0.10.0000.00716.93
8.0.00.0160.01016.91
7.4.330.0000.00515.07
7.4.320.0080.00016.71
7.4.300.0000.00716.73
7.4.290.0040.00416.68
7.4.280.0070.00316.46
7.4.270.0080.00016.60
7.4.260.0030.00316.65
7.4.250.0000.00716.61
7.4.240.0040.00416.60
7.4.230.0070.00016.79
7.4.220.0090.00916.68
7.4.210.0090.00816.74
7.4.200.0000.00716.53
7.4.190.0030.00516.60
7.4.160.0100.00816.55
7.4.150.0110.00817.40
7.4.140.0160.00917.86
7.4.130.0110.00916.55
7.4.120.0080.01116.65
7.4.110.0170.00316.65
7.4.100.0090.01016.67
7.4.90.0110.00816.50
7.4.80.0120.01219.39
7.4.70.0100.01016.68
7.4.60.0120.01216.63
7.4.50.0000.00816.46
7.4.40.0100.00722.77
7.4.30.0100.00716.79
7.4.00.0000.01314.86
7.3.330.0060.00013.54
7.3.320.0050.00013.41
7.3.310.0000.00816.42
7.3.300.0050.00316.32
7.3.290.0060.01016.47
7.3.280.0120.01016.47
7.3.270.0180.00817.40
7.3.260.0140.00416.70
7.3.250.0110.01016.68
7.3.240.0090.00916.53
7.3.230.0080.01616.39
7.3.210.0090.00916.39
7.3.200.0070.01419.39
7.3.190.0140.01016.51
7.3.180.0060.01116.73
7.3.170.0070.01016.46
7.3.160.0140.00316.49
7.3.120.0030.01414.88
7.2.330.0130.00716.65
7.2.320.0160.00616.55
7.2.310.0170.00316.93
7.2.300.0110.00616.59
7.2.290.0060.00916.79
7.2.60.0040.01116.93
7.2.00.0000.01519.05
7.1.200.0030.01015.80
7.1.100.0000.01417.88
7.1.70.0020.00517.16
7.1.60.0130.01319.33
7.1.50.0040.01916.69
7.1.00.0000.08022.46
7.0.200.0040.00814.77
7.0.140.0030.07722.18
7.0.60.0030.05020.07
7.0.50.0070.04017.97
7.0.40.0100.06019.96
7.0.30.0270.05020.16
7.0.20.0230.04720.06
7.0.10.0130.05720.23
7.0.00.0070.09020.21
5.6.280.0070.07021.12
5.6.210.0030.07720.51
5.6.200.0130.07018.25
5.6.190.0130.06720.67
5.6.180.0300.07320.73
5.6.170.0170.04020.61
5.6.160.0070.04020.58
5.6.150.0000.04318.16
5.6.140.0070.05318.24
5.6.130.0070.08318.26
5.6.120.0170.06021.00
5.6.110.0070.04021.03
5.6.100.0130.03721.16
5.6.90.0030.06321.12
5.6.80.0170.05720.44
5.6.70.4600.03320.49
5.5.350.0170.08020.44
5.5.340.0170.07017.98
5.5.330.0070.05320.31
5.5.320.0070.08020.34
5.5.310.0300.07720.48
5.5.300.0030.04717.98
5.5.290.0100.03318.04
5.5.280.0100.04320.79
5.5.270.0170.07320.89
5.5.260.0070.08721.00
5.5.250.0170.06020.71
5.5.240.0130.07320.21
5.4.450.1100.06719.77
5.4.440.0870.05719.64
5.4.430.0600.05719.58
5.4.420.0730.06019.58
5.4.410.1000.07019.50
5.4.400.0870.08319.15
5.4.390.0900.05019.15
5.4.380.0270.05718.80
5.4.370.0200.06318.71
5.4.360.0300.05318.62
5.4.350.0270.06718.61
5.4.340.0370.05718.55
5.4.320.0070.04312.53
5.4.310.0080.04012.53
5.4.300.0100.04312.54
5.4.290.0110.03812.52
5.4.280.0120.05412.40
5.4.270.0110.05412.40
5.4.260.0100.05612.40
5.4.250.0080.05312.40
5.4.240.0100.05412.40
5.4.230.0120.06312.39
5.4.220.0110.06112.39
5.4.210.0120.06012.39
5.4.200.0150.08312.39
5.4.190.0120.06012.39
5.4.180.0150.07712.39
5.4.170.0290.10412.40
5.4.160.0140.05012.39
5.4.150.0130.05512.39
5.4.140.0090.06312.07
5.4.130.0090.03612.07
5.4.120.0080.03912.02
5.4.110.0080.03812.01
5.4.100.0080.03812.02
5.4.90.0060.04312.02
5.4.80.0070.04312.01
5.4.70.0100.03812.01
5.4.60.0160.04012.02
5.4.50.0110.04112.02
5.4.40.0110.03912.00
5.4.30.0070.04412.00
5.4.20.0070.03811.99
5.4.10.0090.03812.00
5.4.00.0110.03311.49
5.3.290.0080.03912.80
5.3.280.0090.03812.71
5.3.270.0080.06612.72
5.3.260.0130.05312.72
5.3.250.0100.05312.71
5.3.240.0120.04012.72
5.3.230.0110.04912.71
5.3.220.0170.04512.68
5.3.210.0140.07112.68
5.3.200.0120.05912.68
5.3.190.0080.05812.68
5.3.180.0240.07812.68
5.3.170.0140.04412.67
5.3.160.0080.06112.67
5.3.150.0120.05412.67
5.3.140.0190.07612.66
5.3.130.0060.04512.66
5.3.120.0180.07412.66
5.3.110.0160.04812.65
5.3.100.0160.04912.12
5.3.90.0220.06012.09
5.3.80.0130.06912.08
5.3.70.0100.05212.07
5.3.60.0160.05012.06
5.3.50.0200.07512.00
5.3.40.0220.07912.00
5.3.30.0110.05111.94
5.3.20.0120.04911.70
5.3.10.0150.05111.67
5.3.00.0110.03811.66
5.2.170.0070.0329.15
5.2.160.0130.0259.15
5.2.150.0070.0339.15
5.2.140.0130.0489.15
5.2.130.0230.0509.11
5.2.120.0070.0369.11
5.2.110.0070.0339.12
5.2.100.0070.0329.11
5.2.90.0080.0479.11
5.2.80.0230.0639.11
5.2.70.0080.0429.11
5.2.60.0050.0339.06
5.2.50.0100.0369.03
5.2.40.0080.0299.01
5.2.30.0080.0418.99
5.2.20.0070.0308.97
5.2.10.0070.0298.90
5.2.00.0060.0428.76
5.1.60.0070.0308.05
5.1.50.0060.0368.05
5.1.40.0050.0298.03
5.1.30.0130.0368.38
5.1.20.0060.0318.40
5.1.10.0070.0278.12
5.1.00.0050.0298.13
5.0.50.0060.0226.60
5.0.40.0070.0466.46
5.0.30.0100.0656.27
5.0.20.0030.0306.24
5.0.10.0080.0596.22
5.0.00.0070.0616.21
4.4.90.0080.0254.78
4.4.80.0080.0254.75
4.4.70.0030.0174.75
4.4.60.0060.0214.76
4.4.50.0080.0224.77
4.4.40.0050.0234.71
4.4.30.0030.0164.76
4.4.20.0040.0174.84
4.4.10.0040.0214.85
4.4.00.0020.0264.76
4.3.110.0030.0154.67
4.3.100.0020.0164.67
4.3.90.0030.0184.64
4.3.80.0040.0244.58
4.3.70.0030.0194.63
4.3.60.0030.0144.62
4.3.50.0040.0144.63
4.3.40.0020.0274.54
4.3.30.0010.0183.27
4.3.20.0040.0173.25
4.3.10.0020.0153.22
4.3.00.0230.03010.37

preferences:
47.87 ms | 404 KiB | 6 Q