3v4l.org

run code in 300+ PHP versions simultaneously
<?php $hotels = [ ['Tibki', 3, 8.0, 6719], ['Nordest', 3, 8.1, 8954], ['Spasio', 3, 8.1, 9362], ['Hasienda', 4, 9.0, 10211], ['The fern', 3, 8.9, 11687], ['Belesa', 4, 8.1, 13234], ['Resort', 3, 9.1, 14252], ['El Hotel', 3, 8.2, 14577], ['Fortuna', 4, 8.1, 15237], ['Mikinos', 3, 8.0, 16289], ['Presa', 4, 8.5, 20360], ['Ramada', 5, 8.1, 23676], ['Olila', 5, 8.6, 27166], ['Goa', 5, 8.2, 33129], ['Vivanta', 5, 8.4, 36816], ['The lila', 5, 9.0, 37579], ['Grand', 5, 8.4, 40720], ]; $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.0190.00018.55
8.3.50.0100.01122.00
8.3.40.0100.01018.97
8.3.30.0060.00919.18
8.3.20.0080.00020.34
8.3.10.0050.00322.27
8.3.00.0090.00022.39
8.2.180.0130.01016.88
8.2.170.0130.01022.96
8.2.160.0080.00820.87
8.2.150.0040.00424.18
8.2.140.0090.00024.66
8.2.130.0030.00626.16
8.2.120.0060.00319.48
8.2.110.0030.00720.53
8.2.100.0100.00317.97
8.2.90.0030.00619.20
8.2.80.0000.00918.05
8.2.70.0060.00317.63
8.2.60.0090.00018.05
8.2.50.0040.00418.07
8.2.40.0060.00318.47
8.2.30.0040.00418.25
8.2.20.0090.00017.75
8.2.10.0040.00417.93
8.2.00.0050.00317.79
8.1.280.0130.00625.92
8.1.270.0040.00422.09
8.1.260.0000.00826.35
8.1.250.0060.00328.09
8.1.240.0100.00023.90
8.1.230.0030.00922.63
8.1.220.0030.00618.04
8.1.210.0040.00418.77
8.1.200.0090.00317.48
8.1.190.0000.00817.65
8.1.180.0090.00018.10
8.1.170.0000.00818.75
8.1.160.0040.00422.14
8.1.150.0030.00518.76
8.1.140.0000.00817.58
8.1.130.0000.00717.89
8.1.120.0050.00217.58
8.1.110.0050.00317.54
8.1.100.0040.00417.64
8.1.90.0080.00017.52
8.1.80.0040.00417.62
8.1.70.0050.00217.48
8.1.60.0040.00417.68
8.1.50.0030.00617.62
8.1.40.0000.00917.69
8.1.30.0060.00317.74
8.1.20.0060.00317.71
8.1.10.0040.00417.57
8.1.00.0030.00617.61
8.0.300.0000.00718.77
8.0.290.0000.00917.29
8.0.280.0040.00418.49
8.0.270.0000.00717.29
8.0.260.0000.01016.91
8.0.250.0040.00417.09
8.0.240.0080.00017.04
8.0.230.0030.00317.07
8.0.220.0040.00416.89
8.0.210.0040.00416.99
8.0.200.0000.00717.07
8.0.190.0040.00417.03
8.0.180.0000.00816.95
8.0.170.0000.00916.91
8.0.160.0070.00016.97
8.0.150.0050.00316.92
8.0.140.0060.00316.98
8.0.130.0000.00613.40
8.0.120.0050.00516.87
8.0.110.0030.00517.07
8.0.100.0040.00417.01
8.0.90.0000.01016.90
8.0.80.0030.01317.07
8.0.70.0030.00516.89
8.0.60.0030.00617.02
8.0.50.0080.00016.96
8.0.30.0080.01517.22
8.0.20.0150.00917.40
8.0.10.0050.00316.97
8.0.00.0090.01116.88
7.4.330.0030.00315.18
7.4.320.0000.00716.63
7.4.300.0060.00016.64
7.4.290.0080.00016.70
7.4.280.0070.00016.68
7.4.270.0040.00416.56
7.4.260.0030.00616.48
7.4.250.0000.00816.50
7.4.240.0030.00516.71
7.4.230.0000.00716.63
7.4.220.0120.00716.79
7.4.210.0060.00916.68
7.4.200.0050.00316.74
7.4.190.0050.00316.70
7.4.160.0140.00316.69
7.4.150.0150.00817.40
7.4.140.0150.01017.86
7.4.130.0180.00316.63
7.4.120.0100.01016.70
7.4.110.0140.01416.76
7.4.100.0190.00816.48
7.4.90.0040.01616.60
7.4.80.0180.00819.39
7.4.70.0140.00616.72
7.4.60.0070.01216.57
7.4.50.0020.00216.55
7.4.40.0050.00722.77
7.4.30.0140.00716.61
7.4.00.0110.00714.91
7.3.330.0000.00713.47
7.3.320.0000.00613.45
7.3.310.0050.00316.50
7.3.300.0000.00716.29
7.3.290.0070.01116.41
7.3.280.0110.00916.49
7.3.270.0080.01217.40
7.3.260.0070.01316.83
7.3.250.0090.01116.63
7.3.240.0130.00816.73
7.3.230.0030.01616.70
7.3.210.0060.01516.66
7.3.200.0110.01419.39
7.3.190.0050.01416.49
7.3.180.0070.01116.75
7.3.170.0160.01016.64
7.3.160.0090.01216.75
7.3.120.0030.01314.91
7.2.330.0240.00316.83
7.2.320.0170.00916.83
7.2.310.0090.01816.82
7.2.300.0070.01316.89
7.2.290.0110.00716.60
7.2.00.0060.00919.32
7.1.200.0040.00715.68
7.1.100.0030.01318.21
7.1.70.0040.00416.88
7.1.60.0030.02019.82
7.1.50.0170.01734.95
7.1.00.0100.07022.48
7.0.200.0080.00016.89
7.0.140.0100.06721.93
7.0.60.0030.07719.99
7.0.50.0030.08717.89
7.0.40.0070.08320.40
7.0.30.0330.05720.23
7.0.20.0330.08020.27
7.0.10.0100.06720.17
7.0.00.0170.07720.16
5.6.280.0100.07021.05
5.6.210.0030.05320.73
5.6.200.0130.07318.19
5.6.190.0030.05320.49
5.6.180.0170.05320.48
5.6.170.0400.07020.45
5.6.160.0070.04320.48
5.6.150.0070.08018.19
5.6.140.0100.06318.15
5.6.130.0000.04718.18
5.6.120.0030.04021.07
5.6.110.0070.08321.11
5.6.100.0070.08321.12
5.6.90.0100.07021.14
5.6.80.0100.05720.46
5.6.70.4430.04020.30
5.5.350.0100.07720.45
5.5.340.0070.07318.09
5.5.330.0200.04020.28
5.5.320.0330.07720.37
5.5.310.0270.07020.23
5.5.300.0030.05718.05
5.5.290.0070.05317.99
5.5.280.0100.08020.96
5.5.270.0170.06320.88
5.5.260.0200.08020.91
5.5.250.0030.08720.52
5.5.240.0130.07020.21
5.4.450.0530.06019.16
5.4.440.0230.06719.34
5.4.430.0900.00019.28
5.4.420.1130.00019.48
5.4.410.0230.04318.87
5.4.400.0130.05718.77
5.4.390.0100.05718.61
5.4.380.0300.06018.83
5.4.370.0030.06318.87
5.4.360.0130.06718.82
5.4.350.0230.05018.80
5.4.340.0100.06018.50
5.4.320.0100.04012.55
5.4.310.0090.05612.54
5.4.300.0090.05312.55
5.4.290.0150.05812.54
5.4.280.0130.05412.41
5.4.270.0110.03812.41
5.4.260.0090.04112.41
5.4.250.0120.03812.41
5.4.240.0050.04412.41
5.4.230.0120.04612.40
5.4.220.0080.04112.40
5.4.210.0140.06012.41
5.4.200.0090.06512.41
5.4.190.0080.04812.39
5.4.180.0060.05412.40
5.4.170.0140.05012.41
5.4.160.0090.04512.41
5.4.150.0090.03812.41
5.4.140.0110.03712.08
5.4.130.0090.05212.07
5.4.120.0100.05312.03
5.4.110.0110.04112.03
5.4.100.0100.03712.03
5.4.90.0080.04012.03
5.4.80.0060.04212.03
5.4.70.0130.03512.02
5.4.60.0080.03812.02
5.4.50.0090.04012.03
5.4.40.0090.04012.01
5.4.30.0060.04212.01
5.4.20.0090.04512.00
5.4.10.0090.05412.00
5.4.00.0090.05511.50
5.3.290.0040.04312.80
5.3.280.0080.05912.71
5.3.270.0070.05612.72
5.3.260.0050.05212.72
5.3.250.0100.04812.72
5.3.240.0090.05312.72
5.3.230.0130.04312.71
5.3.220.0060.04312.68
5.3.210.0040.04512.68
5.3.200.0080.04212.68
5.3.190.0060.05712.67
5.3.180.0070.05312.68
5.3.170.0100.06312.66
5.3.160.0090.03912.67
5.3.150.0080.05712.67
5.3.140.0100.05112.66
5.3.130.0070.04212.66
5.3.120.0050.04412.66
5.3.110.0080.06512.66
5.3.100.0090.05412.12
5.3.90.0150.05512.08
5.3.80.0150.06412.07
5.3.70.0080.05312.07
5.3.60.0090.04912.06
5.3.50.0100.04712.00
5.3.40.0090.06212.00
5.3.30.0120.05711.94
5.3.20.0070.04711.70
5.3.10.0060.03711.67
5.3.00.0030.04111.66
5.2.170.0040.0339.16
5.2.160.0050.0339.16
5.2.150.0040.0369.15
5.2.140.0070.0299.15
5.2.130.0050.0319.11
5.2.120.0030.0329.11
5.2.110.0070.0399.11
5.2.100.0070.0419.12
5.2.90.0060.0359.11
5.2.80.0050.0339.11
5.2.70.0030.0369.11
5.2.60.0070.0329.06
5.2.50.0070.0319.04
5.2.40.0040.0349.00
5.2.30.0030.0338.99
5.2.20.0090.0618.97
5.2.10.0100.0358.90
5.2.00.0060.0448.76
5.1.60.0200.0628.05
5.1.50.0150.0508.04
5.1.40.0080.0418.03
5.1.30.0090.0408.38
5.1.20.0190.0698.39
5.1.10.0140.0378.13
5.1.00.0050.0288.13
5.0.50.0060.0196.60
5.0.40.0070.0186.46
5.0.30.0030.0356.27
5.0.20.0030.0236.24
5.0.10.0060.0216.22
5.0.00.0050.0326.21
4.4.90.0050.0224.78
4.4.80.0060.0244.75
4.4.70.0040.0234.76
4.4.60.0040.0224.75
4.4.50.0020.0254.77
4.4.40.0030.0364.71
4.4.30.0090.0284.76
4.4.20.0090.0224.85
4.4.10.0070.0234.85
4.4.00.0030.0364.75
4.3.110.0040.0234.67
4.3.100.0030.0264.66
4.3.90.0020.0234.63
4.3.80.0010.0354.58
4.3.70.0020.0224.63
4.3.60.0040.0214.63
4.3.50.0060.0324.63
4.3.40.0040.0334.54
4.3.30.0080.0333.27
4.3.20.0030.0213.25
4.3.10.0000.0253.22
4.3.00.0170.0136.31

preferences:
37.96 ms | 401 KiB | 5 Q