3v4l.org

run code in 300+ PHP versions simultaneously
<?php $hotels = [ ['Cala', 3, 8.7, 6000], ['Ocean', 3, 8.2, 6150], ['Orchid', 3, 8.0, 7200], ['Ya', 4, 8.3, 6950], ['Chaba', 3, 8.2, 7120], ]; $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.00716.75
8.3.50.0100.01022.11
8.3.40.0060.00919.00
8.3.30.0100.00719.34
8.3.20.0070.00020.41
8.3.10.0040.00423.73
8.3.00.0060.00319.51
8.2.180.0090.00918.06
8.2.170.0110.00422.96
8.2.160.0110.00420.39
8.2.150.0080.00024.18
8.2.140.0030.00524.66
8.2.130.0040.00426.16
8.2.120.0040.00422.20
8.2.110.0060.00322.38
8.2.100.0040.00818.03
8.2.90.0040.00419.34
8.2.80.0000.00817.97
8.2.70.0000.00817.48
8.2.60.0000.01017.68
8.2.50.0050.00318.07
8.2.40.0000.00818.34
8.2.30.0040.00418.12
8.2.20.0000.00817.90
8.2.10.0000.00718.29
8.2.00.0050.00517.84
8.1.280.0100.00325.92
8.1.270.0080.00023.90
8.1.260.0090.00026.35
8.1.250.0030.00528.09
8.1.240.0060.00324.09
8.1.230.0040.00718.97
8.1.220.0040.00417.74
8.1.210.0050.00318.77
8.1.200.0070.00317.24
8.1.190.0040.00417.53
8.1.180.0000.00818.10
8.1.170.0070.00418.71
8.1.160.0080.00022.09
8.1.150.0080.00018.79
8.1.140.0070.00017.60
8.1.130.0070.00017.78
8.1.120.0030.00517.48
8.1.110.0040.00417.49
8.1.100.0040.00417.46
8.1.90.0000.00717.57
8.1.80.0050.00217.58
8.1.70.0000.00717.50
8.1.60.0080.00017.70
8.1.50.0030.00517.57
8.1.40.0080.00017.47
8.1.30.0000.00917.68
8.1.20.0040.00417.67
8.1.10.0050.00317.67
8.1.00.0030.00517.64
8.0.300.0040.00418.77
8.0.290.0000.00817.30
8.0.280.0040.00418.46
8.0.270.0000.00817.27
8.0.260.0000.00717.37
8.0.250.0030.00317.08
8.0.240.0030.00316.96
8.0.230.0050.00217.06
8.0.220.0030.00317.02
8.0.210.0030.00316.98
8.0.200.0000.00817.05
8.0.190.0070.00016.95
8.0.180.0050.00316.91
8.0.170.0040.00417.08
8.0.160.0000.00716.97
8.0.150.0000.00816.82
8.0.140.0070.00017.00
8.0.130.0000.00613.51
8.0.120.0000.00816.98
8.0.110.0050.00316.96
8.0.100.0040.00416.82
8.0.90.0000.00716.98
8.0.80.0120.00317.05
8.0.70.0080.00017.06
8.0.60.0000.00816.93
8.0.50.0000.00816.80
8.0.30.0110.00917.07
8.0.20.0130.00617.40
8.0.10.0050.00217.00
8.0.00.0110.00716.78
7.4.330.0050.00015.00
7.4.320.0050.00316.64
7.4.300.0000.00616.55
7.4.290.0030.00316.68
7.4.280.0000.00816.60
7.4.270.0000.00716.70
7.4.260.0030.00316.74
7.4.250.0040.00416.71
7.4.240.0020.00516.65
7.4.230.0050.00316.81
7.4.220.0040.01416.65
7.4.210.0050.01016.67
7.4.200.0030.00316.44
7.4.190.0080.00016.51
7.4.160.0130.00316.68
7.4.150.0090.01017.40
7.4.140.0070.01317.86
7.4.130.0120.00516.66
7.4.120.0060.01316.55
7.4.110.0040.01516.61
7.4.100.0150.00316.46
7.4.90.0160.00616.48
7.4.80.0090.01019.39
7.4.70.0140.00416.70
7.4.60.0060.01016.56
7.4.50.0050.00316.82
7.4.40.0000.01622.77
7.4.30.0090.00916.51
7.4.00.0080.01014.92
7.3.330.0030.00313.29
7.3.320.0020.00313.41
7.3.310.0040.00416.57
7.3.300.0030.00316.29
7.3.290.0110.00316.38
7.3.280.0090.01016.45
7.3.270.0090.00917.40
7.3.260.0110.00816.73
7.3.250.0130.00716.62
7.3.240.0030.01816.56
7.3.230.0130.00316.76
7.3.210.0150.00416.43
7.3.200.0150.00919.39
7.3.190.0110.00716.79
7.3.180.0060.00916.70
7.3.170.0100.00716.55
7.3.160.0030.01416.73
7.3.120.0080.00915.02
7.3.110.0050.01314.84
7.3.100.0060.00814.88
7.3.90.0070.00414.96
7.3.80.0110.00414.89
7.3.70.0040.00814.98
7.3.60.0050.00814.89
7.3.50.0060.00714.79
7.3.40.0060.00614.68
7.3.30.0030.00814.96
7.3.20.0060.00916.77
7.3.10.0060.00716.71
7.3.00.0050.00816.65
7.2.330.0090.00916.71
7.2.320.0060.01216.98
7.2.310.0120.01216.94
7.2.300.0080.01117.00
7.2.290.0100.00716.96
7.2.250.0100.00915.20
7.2.240.0070.01114.98
7.2.230.0070.01015.17
7.2.220.0100.00615.06
7.2.210.0110.00514.96
7.2.200.0030.00815.14
7.2.190.0050.00715.14
7.2.180.0060.01015.05
7.2.170.0060.00915.02
7.2.60.0030.00916.74
7.2.00.0110.00419.20
7.1.330.0120.00315.79
7.1.320.0090.00615.72
7.1.310.0100.00315.82
7.1.300.0040.00815.82
7.1.290.0090.00715.85
7.1.280.0020.01315.73
7.1.270.0070.00515.76
7.1.260.0050.00815.74
7.1.200.0030.01015.54
7.1.100.0030.00918.05
7.1.70.0060.00617.16
7.1.60.0070.01719.33
7.1.50.0260.01034.64
7.1.00.0000.08022.35
7.0.200.0030.00714.82
7.0.140.0000.07721.95
7.0.60.0000.04319.85
7.0.50.0130.04017.88
7.0.40.0130.07317.71
7.0.30.0030.04317.75
7.0.20.0030.05717.77
7.0.10.0070.08017.72
7.0.00.0030.08317.79
5.6.210.0070.07320.72
5.6.200.0070.04018.13
5.6.190.0070.05718.15
5.6.180.0070.05018.19
5.6.170.0100.07718.16
5.6.160.0030.07018.29
5.6.150.0070.07718.22
5.6.140.0100.07318.15
5.6.130.0130.07018.25
5.6.120.0070.06718.18
5.6.110.0030.04318.18
5.6.100.0070.08718.17
5.6.90.0030.07318.22
5.6.80.0100.06717.67
5.6.70.0030.08017.59
5.6.60.0070.04717.55
5.6.50.0000.06317.52
5.6.40.0070.04717.63
5.6.30.0100.06717.64
5.6.20.0030.08317.59
5.6.10.0070.08317.52
5.6.00.0230.05017.50
5.5.350.0170.08720.40
5.5.340.0100.04318.09
5.5.330.0030.06018.03
5.5.320.0030.05317.99
5.5.310.0030.08018.09
5.5.300.0030.04318.05
5.5.290.0000.08718.08
5.5.280.0100.08017.95
5.5.270.0070.04017.94
5.5.260.0070.06717.98
5.5.250.0070.08017.76
5.5.240.0070.07317.43
5.5.230.0030.04017.37
5.5.220.0200.06717.39
5.5.210.0070.07317.48
5.5.200.0070.03717.40
5.5.190.0070.06717.35
5.5.180.0100.07017.34
5.5.160.0100.07017.42
5.5.150.0070.07317.33
5.5.140.0100.05717.44
5.5.130.0070.07317.30
5.5.120.0030.05317.33
5.5.110.0030.08017.32
5.5.100.0070.04717.34
5.5.90.0000.08017.32
5.5.80.0100.07717.33
5.5.70.0030.08017.22
5.5.60.0000.08017.26
5.5.50.0030.04017.29
5.5.40.0100.05717.29
5.5.30.0070.07317.29
5.5.20.0070.08017.32
5.5.10.0070.07717.32
5.5.00.0030.08317.23
5.4.450.0030.05019.42
5.4.440.0070.05019.47
5.4.430.0030.06019.42
5.4.420.0070.08319.35
5.4.410.0030.08019.29
5.4.400.0130.05719.02
5.4.390.0030.08019.11
5.4.380.0100.07719.06
5.4.370.0100.04319.07
5.4.360.0130.06319.23
5.4.350.0070.04719.04
5.4.340.0130.06319.02
5.4.320.0100.06719.02
5.4.310.0130.04319.05
5.4.300.0000.07719.27
5.4.290.0070.04019.16
5.4.280.0130.07019.09
5.4.270.0030.08019.11
5.4.260.0000.04319.27
5.4.250.0030.07319.15
5.4.240.0030.04719.08
5.4.230.0030.04018.95
5.4.220.0130.06719.05
5.4.210.0070.05019.06
5.4.200.0100.06319.13
5.4.190.0100.05719.04
5.4.180.0030.08319.04
5.4.170.0100.04319.07
5.4.160.0100.04019.04
5.4.150.0070.07719.10
5.4.140.0070.07316.48
5.4.130.0070.03716.44
5.4.120.0230.05716.49
5.4.110.0100.04016.53
5.4.100.0070.07716.55
5.4.90.0000.05016.46
5.4.80.0100.07316.44
5.4.70.0030.06716.54
5.4.60.0170.06016.43
5.4.50.0100.04316.50
5.4.40.0000.04016.52
5.4.30.0100.07016.49
5.4.20.0070.07316.45
5.4.10.0100.06016.49
5.4.00.0070.04016.08
5.3.290.0030.08314.62
5.3.280.0070.04714.54
5.3.270.0070.06714.69
5.3.260.0030.08014.57
5.3.250.0130.06714.42
5.3.240.0030.05014.54
5.3.230.0130.03014.42
5.3.220.0100.06014.48
5.3.210.0100.06314.43
5.3.200.0100.03014.39
5.3.190.0030.06014.48
5.3.180.0030.04714.39
5.3.170.0130.07314.54
5.3.160.0070.05014.54
5.3.150.0100.07314.53
5.3.140.0070.04314.37
5.3.130.0070.08014.40
5.3.120.0070.07314.52
5.3.110.0070.06714.52
5.3.100.0000.05014.11
5.3.90.0000.06013.98
5.3.80.0130.05714.00
5.3.70.0100.07313.98
5.3.60.0070.06313.96
5.3.50.0070.04013.91
5.3.40.0130.07013.71
5.3.30.0130.04713.90
5.3.20.0030.05313.63
5.3.10.0070.06313.42
5.3.00.0100.06713.60
5.2.170.0070.06011.29
5.2.160.0100.02710.93
5.2.150.0030.06710.93
5.2.140.0030.04310.97
5.2.130.0130.05311.07
5.2.120.0070.05710.94
5.2.110.0070.03310.93
5.2.100.0000.05311.07
5.2.90.0030.05711.02
5.2.80.0030.05311.09
5.2.70.0070.06011.09
5.2.60.0030.06711.04
5.2.50.0000.04711.01
5.2.40.0000.06711.00
5.2.30.0100.03710.79
5.2.20.0030.03310.99
5.2.10.0030.06010.89
5.2.00.0000.05010.72
5.1.60.0100.0379.97
5.1.50.0030.0579.96
5.1.40.0030.0309.96
5.1.30.0000.03010.29
5.1.20.0030.04010.34
5.1.10.0070.03710.10
5.1.00.0030.0339.98
5.0.50.0000.0308.64
5.0.40.0030.0438.64
5.0.30.0000.0478.64
5.0.20.0070.0308.64
5.0.10.0000.0208.64
5.0.00.0000.0478.64
4.4.90.0030.0208.64
4.4.80.0000.0338.64
4.4.70.0000.0178.64
4.4.60.0000.0178.64
4.4.50.0030.0308.64
4.4.40.0100.0508.64
4.4.30.0030.0238.64
4.4.20.0000.0408.64
4.4.10.0000.0238.64
4.4.00.0070.0508.64
4.3.110.0030.0308.64
4.3.100.0000.0178.64
4.3.90.0000.0208.64
4.3.80.0100.0238.64
4.3.70.0000.0178.64
4.3.60.0000.0378.64
4.3.50.0030.0378.64
4.3.40.0000.0578.64
4.3.30.0000.0408.64
4.3.20.0000.0208.64
4.3.10.0000.0408.64
4.3.00.0000.0408.64

preferences:
51.99 ms | 400 KiB | 5 Q