3v4l.org

run code in 300+ PHP versions simultaneously
<?php $hotels = [ ['Tsambika', 2, 8.1, 9122], ['Tivoli', 2, 8.1, 11403], ['Radian', 2, 8.4, 17267], ['Filmar', 2, 8.4, 18510], ['Mon', 2, 8.7, 19222], ['Liristik', 0, 9.1, 20851], ['Zoyas', 3, 8.8, 22362], ['Nirvana', 3, 8.7, 24434], ]; $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.0100.01016.75
8.3.50.0080.00822.04
8.3.40.0150.00018.84
8.3.30.0120.00319.26
8.3.20.0080.00020.49
8.3.10.0040.00423.78
8.3.00.0080.00019.38
8.2.180.0060.01316.50
8.2.170.0150.00022.96
8.2.160.0100.01020.35
8.2.150.0060.00324.18
8.2.140.0000.00824.66
8.2.130.0100.01026.16
8.2.120.0040.00422.20
8.2.110.0150.00022.24
8.2.100.0040.00717.91
8.2.90.0050.00319.39
8.2.80.0040.00418.05
8.2.70.0000.01017.63
8.2.60.0090.00018.05
8.2.50.0030.00518.07
8.2.40.0040.00418.41
8.2.30.0000.00718.36
8.2.20.0000.00817.88
8.2.10.0000.00818.23
8.2.00.0060.00617.93
8.1.280.0000.01425.92
8.1.270.0000.00922.14
8.1.260.0040.00426.35
8.1.250.0060.00328.09
8.1.240.0000.00923.87
8.1.230.0000.01119.22
8.1.220.0050.00317.79
8.1.210.0040.00418.77
8.1.200.0030.00617.47
8.1.190.0000.00817.65
8.1.180.0030.00518.10
8.1.170.0040.00418.72
8.1.160.0050.00322.11
8.1.150.0000.00718.71
8.1.140.0060.00317.48
8.1.130.0070.00017.81
8.1.120.0000.00717.59
8.1.110.0030.00517.55
8.1.100.0020.00517.55
8.1.90.0040.00417.48
8.1.80.0070.00017.63
8.1.70.0000.00717.52
8.1.60.0060.00317.69
8.1.50.0060.00317.52
8.1.40.0040.00417.59
8.1.30.0050.00517.71
8.1.20.0030.00617.75
8.1.10.0050.00317.66
8.1.00.0000.00817.59
8.0.300.0000.00818.77
8.0.290.0050.00317.05
8.0.280.0000.00718.56
8.0.270.0040.00417.43
8.0.260.0030.00317.24
8.0.250.0040.00417.08
8.0.240.0070.00017.08
8.0.230.0040.00416.98
8.0.220.0030.00316.88
8.0.210.0030.00316.84
8.0.200.0040.00416.95
8.0.190.0000.00716.97
8.0.180.0040.00416.99
8.0.170.0030.00517.02
8.0.160.0040.00417.05
8.0.150.0040.00416.86
8.0.140.0030.00316.97
8.0.130.0060.00013.41
8.0.120.0000.00816.86
8.0.110.0050.00316.97
8.0.100.0000.00716.89
8.0.90.0070.00017.13
8.0.80.0090.00917.01
8.0.70.0000.00716.80
8.0.60.0000.00816.88
8.0.50.0040.00416.81
8.0.30.0060.01417.11
8.0.20.0110.01417.40
8.0.10.0050.00217.13
8.0.00.0060.01317.04
7.4.330.0000.00515.11
7.4.320.0050.00216.53
7.4.300.0030.00516.63
7.4.290.0070.00016.54
7.4.280.0030.00616.51
7.4.270.0000.00716.55
7.4.260.0050.00316.66
7.4.250.0080.00016.55
7.4.240.0000.00716.65
7.4.230.0070.00016.41
7.4.220.0110.00716.72
7.4.210.0060.01016.68
7.4.200.0030.00316.64
7.4.190.0040.00416.81
7.4.160.0100.00716.58
7.4.150.0160.01017.40
7.4.140.0070.01117.86
7.4.130.0080.01216.66
7.4.120.0080.01116.62
7.4.110.0100.00716.58
7.4.100.0130.01016.68
7.4.90.0100.00716.66
7.4.80.0120.00819.39
7.4.70.0030.01516.59
7.4.60.0090.00916.61
7.4.50.0060.00316.44
7.4.40.0120.00222.77
7.4.30.0080.00816.73
7.4.10.0040.01515.08
7.4.00.0090.00914.67
7.3.330.0030.00313.42
7.3.320.0030.00313.41
7.3.310.0030.00316.54
7.3.300.0040.00416.37
7.3.290.0090.00616.46
7.3.280.0080.01416.47
7.3.270.0090.01617.40
7.3.260.0090.01016.77
7.3.250.0080.01216.51
7.3.240.0120.00616.74
7.3.230.0090.00916.46
7.3.210.0060.01216.40
7.3.200.0160.00319.39
7.3.190.0060.01216.53
7.3.180.0100.00716.51
7.3.170.0110.00816.73
7.3.160.0070.01016.64
7.3.130.0090.00915.07
7.3.120.0110.00614.91
7.3.110.0090.00814.90
7.3.100.0080.00614.84
7.3.90.0090.00614.77
7.3.80.0070.00714.86
7.3.70.0090.00614.80
7.3.60.0070.00714.82
7.3.50.0030.01214.84
7.3.40.0060.00814.86
7.3.30.0040.00814.71
7.3.20.0040.01116.73
7.3.10.0050.01216.70
7.3.00.0050.01016.68
7.2.330.0150.00316.75
7.2.320.0030.01416.85
7.2.310.0110.01316.86
7.2.300.0090.00916.85
7.2.290.0090.00916.89
7.2.260.0130.00314.77
7.2.250.0130.00615.09
7.2.240.0050.01115.22
7.2.230.0030.01115.04
7.2.220.0060.01015.10
7.2.210.0100.00515.21
7.2.200.0030.01115.07
7.2.190.0100.00715.00
7.2.180.0070.00514.96
7.2.170.0070.00515.09
7.2.160.0030.01414.96
7.2.150.0050.01016.98
7.2.140.0060.00816.92
7.2.130.0060.00816.95
7.2.120.0030.01416.95
7.2.110.0090.00416.75
7.2.100.0050.00916.87
7.2.90.0060.00916.90
7.2.80.0100.00516.78
7.2.70.0080.00816.92
7.2.60.0050.01016.85
7.2.50.0030.01116.86
7.2.40.0030.00916.91
7.2.30.0070.00916.85
7.2.20.0050.01216.80
7.2.10.0020.00916.96
7.2.00.0060.00817.69
7.1.330.0080.00615.65
7.1.320.0100.00215.87
7.1.310.0050.01015.87
7.1.300.0040.01115.84
7.1.290.0090.00515.76
7.1.280.0040.01115.73
7.1.270.0100.00515.82
7.1.260.0030.00815.86
7.1.250.0040.00715.89
7.1.240.0090.00616.03
7.1.230.0100.00615.90
7.1.220.0000.01315.93
7.1.210.0030.01015.91
7.1.200.0040.00915.93
7.1.190.0060.00915.95
7.1.180.0150.00015.80
7.1.170.0040.01115.54
7.1.160.0070.00715.59
7.1.150.0000.01415.69
7.1.140.0000.00915.93
7.1.130.0060.00615.82
7.1.120.0040.00415.90
7.1.110.0040.01116.02
7.1.100.0080.00616.92
7.1.90.0030.01015.76
7.1.80.0070.00315.56
7.1.70.0060.00616.30
7.1.60.0080.01217.56
7.1.50.0080.00516.35
7.1.40.0070.00316.01
7.1.30.0090.00615.61
7.1.20.0090.00615.83
7.1.10.0000.01315.82
7.1.00.0050.04219.04
7.0.330.0100.00315.33
7.0.320.0070.00415.66
7.0.310.0060.00615.55
7.0.300.0040.00715.18
7.0.290.0070.00715.50
7.0.280.0040.01115.48
7.0.270.0040.01115.45
7.0.260.0070.00715.61
7.0.250.0070.00715.39
7.0.240.0070.00415.52
7.0.230.0070.00715.44
7.0.220.0110.00315.37
7.0.210.0120.00315.59
7.0.200.0080.00515.26
7.0.190.0080.00015.25
7.0.180.0070.00715.54
7.0.170.0120.00315.33
7.0.160.0140.00315.55
7.0.150.0060.01015.46
7.0.140.0060.03918.64
7.0.130.0000.01415.45
7.0.120.0030.00615.48
7.0.110.0000.00815.49
7.0.100.0040.00815.45
7.0.90.0030.00715.54
7.0.80.0060.00615.63
7.0.70.0130.00015.45
7.0.60.0140.04417.73
7.0.50.0070.02216.71
7.0.40.0070.03716.70
7.0.30.0180.02116.89
7.0.20.0190.04116.77
7.0.10.0080.04316.75
7.0.00.0110.04016.79
5.6.400.0070.00714.48
5.6.390.0060.00614.72
5.6.380.0060.00314.79
5.6.370.0060.00914.42
5.6.360.0070.00714.29
5.6.350.0000.01814.60
5.6.340.0030.01014.37
5.6.330.0080.00414.54
5.6.320.0030.01014.75
5.6.310.0120.00014.52
5.6.300.0060.00314.77
5.6.290.0060.00314.25
5.6.280.0050.04217.70
5.6.270.0060.00614.79
5.6.260.0160.00014.42
5.6.250.0030.01014.35
5.6.240.0000.00914.27
5.6.230.0040.01114.57
5.6.220.0040.01414.64
5.6.210.0130.03717.67
5.6.200.0040.04216.26
5.6.190.0080.02317.39
5.6.180.0140.04517.46
5.6.170.0080.02417.53
5.6.160.0090.03117.55
5.6.150.0070.04516.51
5.6.140.0130.04016.42
5.6.130.0110.03116.42
5.6.120.0100.04317.73
5.6.110.0100.02717.71
5.6.100.0120.02717.92
5.6.90.0060.04417.80
5.6.80.0000.03817.34
5.6.70.0080.00314.23
5.6.60.0120.00314.38
5.6.50.0090.00914.55
5.6.40.0030.00914.36
5.6.30.0090.00914.36
5.6.20.0030.01714.55
5.6.10.0090.00614.36
5.6.00.0070.01014.34
5.5.380.0110.00314.69
5.5.370.0000.01414.45
5.5.360.0060.00314.70
5.5.350.0120.04217.50
5.5.340.0100.03716.09
5.5.330.0090.02417.51
5.5.320.0030.04417.21
5.5.310.0130.03717.58
5.5.300.0020.02816.35
5.5.290.0140.03316.26
5.5.280.0100.03517.69
5.5.270.0040.02917.71
5.5.260.0050.03517.67
5.5.250.0050.04317.46
5.5.240.0230.03817.32
5.5.230.0000.01614.51
5.5.220.0110.00614.38
5.5.210.0050.00514.10
5.5.200.0030.01314.48
5.5.190.0100.01014.46
5.5.180.0070.01314.34
5.5.170.0090.00614.19
5.5.160.0070.01014.16
5.5.150.0070.00314.00
5.5.140.0030.00614.35
5.5.130.0030.01014.50
5.5.120.0040.00814.14
5.5.110.0040.00814.27
5.5.100.0070.00714.24
5.5.90.0000.01514.39
5.5.80.0000.00913.94
5.5.70.0070.00714.50
5.5.60.0140.00314.53
5.5.50.0060.01014.33
5.5.40.0080.00414.11
5.5.30.0060.00914.40
5.5.20.0060.00914.34
5.5.10.0030.01214.55
5.5.00.0000.01214.54
5.4.450.0430.03015.45
5.4.440.0510.03115.36
5.4.430.0200.03315.44
5.4.420.0170.03015.29
5.4.410.0450.03015.44
5.4.400.0470.03415.32
5.4.390.0400.03315.05
5.4.380.0130.03714.89
5.4.370.0170.03914.85
5.4.360.0130.03414.79
5.4.350.0130.03814.87
5.4.340.0150.03414.95
5.4.330.0030.00911.11
5.4.320.0070.02111.83
5.4.310.0080.02411.77
5.4.300.0070.02311.80
5.4.290.0080.02511.89
5.4.280.0060.02811.84
5.4.270.0120.03811.76
5.4.260.0080.02511.77
5.4.250.0060.02511.76
5.4.240.0040.02511.75
5.4.230.0090.02411.78
5.4.220.0120.02911.79
5.4.210.0080.03111.70
5.4.200.0190.03011.73
5.4.190.0060.03111.86
5.4.180.0100.02811.79
5.4.170.0080.02111.68
5.4.160.0080.02711.79
5.4.150.0040.02411.69
5.4.140.0050.03111.73
5.4.130.0090.02711.77
5.4.120.0090.02911.49
5.4.110.0110.01911.55
5.4.100.0080.02111.63
5.4.90.0070.03011.56
5.4.80.0050.02411.64
5.4.70.0080.02211.50
5.4.60.0040.02911.44
5.4.50.0050.03111.54
5.4.40.0070.02711.44
5.4.30.0040.02411.50
5.4.20.0090.02911.64
5.4.10.0030.02511.63
5.4.00.0050.02311.38
5.3.290.0020.02711.40
5.3.280.0050.02611.36
5.3.270.0080.02311.33
5.3.260.0040.02911.49
5.3.250.0070.02611.45
5.3.240.0050.02311.27
5.3.230.0060.02211.41
5.3.220.0080.02011.37
5.3.210.0040.03311.41
5.3.200.0050.02411.40
5.3.190.0060.02511.41
5.3.180.0050.02811.51
5.3.170.0080.02811.54
5.3.160.0060.02611.46
5.3.150.0100.03811.49
5.3.140.0040.02711.33
5.3.130.0080.02111.36
5.3.120.0040.03411.42
5.3.110.0080.02611.49
5.3.100.0040.02511.20
5.3.90.0060.02511.12
5.3.80.0060.02711.15
5.3.70.0070.03511.15
5.3.60.0020.02611.16
5.3.50.0040.02211.08
5.3.40.0040.02311.08
5.3.30.0050.02311.04
5.3.20.0040.02510.83
5.3.10.0090.02510.81
5.3.00.0070.02710.86
5.2.170.0060.0419.16
5.2.160.0130.0409.15
5.2.150.0180.0729.15
5.2.140.0130.0709.15
5.2.130.0120.0559.11
5.2.120.0060.0299.11
5.2.110.0060.0339.11
5.2.100.0140.0369.11
5.2.90.0080.0529.11
5.2.80.0070.0329.11
5.2.70.0120.0349.11
5.2.60.0090.0399.06
5.2.50.0110.0369.04
5.2.40.0050.0359.00
5.2.30.0090.0398.98
5.2.20.0040.0368.97
5.2.10.0080.0368.90
5.2.00.0060.0318.77
5.1.60.0060.0258.05
5.1.50.0070.0258.04
5.1.40.0080.0238.02
5.1.30.0040.0298.38
5.1.20.0100.0238.40
5.1.10.0070.0268.13
5.1.00.0030.0298.13
5.0.50.0020.0246.59
5.0.40.0020.0236.46
5.0.30.0020.0356.27
5.0.20.0040.0216.25
5.0.10.0070.0256.22
5.0.00.0060.0396.21
4.4.90.0050.0184.78
4.4.80.0100.0334.75
4.4.70.0110.0464.75
4.4.60.0150.0424.76
4.4.50.0040.0184.77
4.4.40.0050.0264.71
4.4.30.0050.0164.76
4.4.20.0040.0194.84
4.4.10.0040.0184.85
4.4.00.0030.0324.76
4.3.110.0030.0194.67
4.3.100.0020.0244.66
4.3.90.0070.0184.63
4.3.80.0050.0314.58
4.3.70.0060.0194.63
4.3.60.0040.0164.63
4.3.50.0030.0174.63
4.3.40.0030.0254.54
4.3.30.0040.0153.27
4.3.20.0040.0233.25
4.3.10.0060.0303.21
4.3.00.0230.02710.37

preferences:
39.51 ms | 401 KiB | 5 Q