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', 3, 8.7, 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]; $priceToCompensate = $ratingDifference*$ratingCoef; $price = $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.01018.56
8.3.50.0070.01222.11
8.3.40.0070.00718.67
8.3.30.0060.01018.63
8.3.20.0080.00018.74
8.3.10.0030.00620.48
8.3.00.0070.01121.86
8.2.180.0090.00916.75
8.2.170.0130.00322.96
8.2.160.0070.00720.39
8.2.150.0060.00324.18
8.2.140.0070.00324.66
8.2.130.0040.00426.16
8.2.120.0030.00619.48
8.2.110.0100.00022.26
8.2.100.0080.00417.78
8.2.90.0040.00419.17
8.2.80.0000.00817.97
8.2.70.0040.00417.50
8.2.60.0030.00617.88
8.2.50.0080.00018.07
8.2.40.0000.00818.16
8.2.30.0050.00319.80
8.2.20.0020.00517.71
8.2.10.0040.00417.79
8.2.00.0050.00317.69
8.1.280.0040.01425.92
8.1.270.0040.00423.99
8.1.260.0040.00426.35
8.1.250.0070.00028.09
8.1.240.0000.00922.19
8.1.230.0080.00417.45
8.1.220.0030.00617.74
8.1.210.0000.00918.77
8.1.200.0060.00317.35
8.1.190.0000.00817.51
8.1.180.0000.00818.10
8.1.170.0040.00418.76
8.1.160.0040.00418.92
8.1.150.0030.00518.72
8.1.140.0040.00417.45
8.1.130.0000.00717.90
8.1.120.0000.00717.38
8.1.110.0050.00217.52
8.1.100.0000.00817.47
8.1.90.0050.00217.50
8.1.80.0040.00417.47
8.1.70.0070.00017.48
8.1.60.0000.00817.58
8.1.50.0040.00417.55
8.1.40.0000.00717.50
8.1.30.0080.00017.53
8.1.20.0040.00417.68
8.1.10.0040.00417.54
8.1.00.0040.00417.56
8.0.300.0040.00418.77
8.0.290.0040.00416.75
8.0.280.0080.00018.53
8.0.270.0050.00317.29
8.0.260.0070.00016.91
8.0.250.0000.00717.03
8.0.240.0000.01116.99
8.0.230.0000.00717.01
8.0.220.0030.00316.83
8.0.210.0000.00816.92
8.0.200.0030.00316.93
8.0.190.0060.00316.93
8.0.180.0040.00417.00
8.0.170.0000.00916.81
8.0.160.0000.00716.98
8.0.150.0000.00816.87
8.0.140.0000.01316.80
8.0.130.0070.00013.39
8.0.120.0040.00416.89
8.0.110.0080.00316.84
8.0.100.0040.00417.03
8.0.90.0050.00217.00
8.0.80.0090.00616.85
8.0.70.0070.00017.01
8.0.60.0030.00516.89
8.0.50.0000.00816.76
8.0.30.0150.00617.10
8.0.20.0110.01117.40
8.0.10.0040.00417.06
8.0.00.0100.01016.77
7.4.330.0000.00514.78
7.4.320.0000.00616.45
7.4.300.0060.00016.59
7.4.290.0000.00716.65
7.4.280.0030.00616.62
7.4.270.0000.00716.64
7.4.260.0030.00313.43
7.4.250.0070.00016.54
7.4.240.0040.00416.64
7.4.230.0020.00516.66
7.4.220.0130.00316.54
7.4.210.0080.00916.60
7.4.200.0030.00316.30
7.4.190.0030.00316.73
7.4.160.0100.00516.45
7.4.150.0090.00917.40
7.4.140.0080.01017.86
7.4.130.0070.01016.50
7.4.120.0120.00616.46
7.4.110.0160.00316.45
7.4.100.0150.00316.47
7.4.90.0110.00616.59
7.4.80.0060.01219.37
7.4.70.0040.01216.39
7.4.60.0070.01016.64
7.4.50.0080.00016.39
7.4.40.0080.00822.27
7.4.30.0140.00716.43
7.4.00.0030.01315.19
7.3.330.0030.00313.27
7.3.320.0000.00613.19
7.3.310.0030.00316.43
7.3.300.0070.00016.47
7.3.290.0090.00616.41
7.3.280.0060.01016.38
7.3.270.0100.00717.40
7.3.260.0080.01018.24
7.3.250.0120.01216.50
7.3.240.0000.01716.37
7.3.230.0070.01016.55
7.3.210.0090.00916.55
7.3.200.0030.01519.39
7.3.190.0130.00916.32
7.3.180.0090.00616.55
7.3.170.0030.01416.36
7.3.160.0160.00716.61
7.3.120.0070.01014.84
7.3.10.0090.00616.46
7.3.00.0030.01016.63
7.2.330.0110.00716.64
7.2.320.0120.00616.71
7.2.310.0100.01016.55
7.2.300.0140.01016.89
7.2.290.0170.00016.64
7.2.130.0120.00316.95
7.2.120.0040.01116.95
7.2.110.0100.00316.80
7.2.100.0110.00716.73
7.2.90.0030.01317.10
7.2.80.0000.01016.92
7.2.70.0030.00616.72
7.2.60.0090.00617.09
7.2.50.0080.00417.08
7.2.40.0090.00316.66
7.2.30.0100.00317.02
7.2.20.0060.00917.11
7.2.10.0080.00316.79
7.2.00.0050.01018.21
7.1.250.0050.00315.68
7.1.100.0090.00317.97
7.1.70.0060.01017.16
7.1.60.0130.01319.40
7.1.50.0060.01516.88
7.1.00.0000.04722.39
7.0.200.0040.00416.50
7.0.140.0100.07022.15
7.0.70.0030.08021.93
7.0.60.0130.06721.79
7.0.50.0130.06322.14
7.0.40.0100.06320.11
7.0.30.0000.09020.14
7.0.20.0030.08320.04
7.0.10.0030.08720.04
7.0.00.0070.08020.17
5.6.280.0000.07720.92
5.6.220.0070.06020.59
5.6.210.0130.05720.59
5.6.200.0100.07721.05
5.6.190.0070.06021.13
5.6.180.0000.06720.97
5.6.170.0000.09321.03
5.6.160.0030.08021.04
5.6.150.0030.08720.97
5.6.140.0030.08320.96
5.6.130.0100.07021.03
5.6.120.0130.08021.05
5.6.110.0100.08320.96
5.6.100.0030.07721.03
5.6.90.0000.09321.04
5.6.80.0030.05320.43
5.6.70.0070.07720.56
5.6.60.0030.08320.47
5.6.50.0070.08020.57
5.6.40.0000.08020.43
5.6.30.0130.07020.32
5.6.20.0070.08020.50
5.6.10.0030.08320.45
5.6.00.0030.07020.29
5.5.360.0070.08320.50
5.5.350.0100.09020.40
5.5.340.0130.07720.82
5.5.330.0070.08020.95
5.5.320.0000.06320.86
5.5.310.0030.06320.90
5.5.300.0030.06720.81
5.5.290.0030.08320.81
5.5.280.0100.08020.84
5.5.270.0170.07020.78
5.5.260.0000.07020.80
5.5.250.0030.06720.71
5.5.240.0070.07720.26
5.5.230.0000.08320.31
5.5.220.0100.07320.28
5.5.210.0030.07020.12
5.5.200.0100.08020.10
5.5.190.0030.07320.16
5.5.180.0130.05320.10
5.5.160.0070.07720.12
5.5.150.0030.04720.01
5.5.140.0100.07320.17
5.5.130.0030.06320.13
5.5.120.0200.06020.01
5.5.110.0100.07020.25
5.5.100.0100.07020.09
5.5.90.0000.07320.13
5.5.80.0100.04720.16
5.5.70.0070.06019.96
5.5.60.0000.07020.17
5.5.50.0000.05020.07
5.5.40.0000.04020.10
5.5.30.0000.04020.06
5.5.20.0030.03720.04
5.5.10.0000.04020.07
5.5.00.0000.04020.02
5.4.450.0070.08319.56
5.4.440.0000.08319.45
5.4.430.0130.06719.37
5.4.420.0000.08319.32
5.4.410.0070.07719.24
5.4.400.0130.06719.05
5.4.390.0030.05019.20
5.4.380.0000.06718.94
5.4.370.0170.06719.12
5.4.360.0030.08318.87
5.4.350.0000.08319.09
5.4.340.0030.08019.04
5.4.320.0070.05719.00
5.4.310.0030.08018.95
5.4.300.0030.06719.23
5.4.290.0070.03719.03
5.4.280.0100.07019.04
5.4.270.0070.07319.18
5.4.260.0030.07718.94
5.4.250.0030.04719.16
5.4.240.0070.06019.01
5.4.230.0000.08318.86
5.4.220.0100.03319.18
5.4.210.0030.06718.94
5.4.200.0000.04019.11
5.4.190.0030.03719.17
5.4.180.0000.04019.03
5.4.170.0030.03719.20
5.4.160.0030.04719.20
5.4.150.0030.03719.18
5.4.140.0030.03716.34
5.4.130.0070.03316.49
5.4.120.0000.03716.36
5.4.110.0070.03316.47
5.4.100.0070.04316.43
5.4.90.0030.03316.51
5.4.80.0000.04316.32
5.4.70.0000.04016.48
5.4.60.0000.04016.41
5.4.50.0000.03716.44
5.4.40.0200.02016.37
5.4.30.0030.03316.47
5.4.20.0000.03716.32
5.4.10.0100.03316.41
5.4.00.0030.03015.65
5.3.290.0100.06714.66
5.3.280.0000.08314.59
5.3.270.0000.04314.60
5.3.260.0000.04014.61
5.3.250.0030.03714.59
5.3.240.0000.03714.46
5.3.230.0000.05314.46
5.3.220.0000.03714.55
5.3.210.0030.03714.52
5.3.200.0070.03714.39
5.3.190.0000.03714.38
5.3.180.0070.04314.42
5.3.170.0030.03314.55
5.3.160.0030.03714.47
5.3.150.0030.03714.55
5.3.140.0000.04014.42
5.3.130.0070.03314.50
5.3.120.0030.03714.46
5.3.110.0000.03714.41
5.3.100.0000.03714.00
5.3.90.0000.03014.02
5.3.80.0030.03313.95
5.3.70.0030.04713.79
5.3.60.0030.03313.77
5.3.50.0070.03713.90
5.3.40.0000.03713.92
5.3.30.0030.02713.76
5.3.20.0030.02713.66
5.3.10.0070.02713.65
5.3.00.0030.03713.39
5.2.170.0000.03012.79
5.2.160.0030.02712.79
5.2.150.0000.03012.79
5.2.140.0000.03012.79
5.2.130.0030.02712.79
5.2.120.0030.03712.79
5.2.110.0000.03312.79
5.2.100.0000.02312.79
5.2.90.0000.04312.79
5.2.80.0030.05712.79
5.2.70.0070.02312.79
5.2.60.0000.02312.79
5.2.50.0000.02312.79
5.2.40.0000.02312.79
5.2.30.0000.03312.79
5.2.20.0000.06312.79
5.2.10.0000.03012.79
5.2.00.0000.03712.79
5.1.60.0000.04312.79
5.1.50.0000.02012.79
5.1.40.0000.03012.79
5.1.30.0000.02312.79
5.1.20.0070.02012.79
5.1.10.0000.03312.79
5.1.00.0030.04312.79
5.0.50.0030.02012.79
5.0.40.0000.02012.79
5.0.30.0030.02312.79
5.0.20.0000.02712.79
5.0.10.0030.01712.79
5.0.00.0030.04712.79
4.4.90.0000.01712.79
4.4.80.0000.01312.79
4.4.70.0030.01012.79
4.4.60.0030.01312.79
4.4.50.0030.02712.79
4.4.40.0030.01712.79
4.4.30.0000.01312.79
4.4.20.0000.01312.79
4.4.10.0000.01312.79
4.4.00.0000.02312.79
4.3.110.0000.01712.79
4.3.100.0000.01712.79
4.3.90.0000.01712.79
4.3.80.0000.04712.79
4.3.70.0000.03312.79
4.3.60.0030.02312.79
4.3.50.0000.03712.79
4.3.40.0000.05312.79
4.3.30.0000.04012.79
4.3.20.0000.04012.79
4.3.10.0000.04012.79
4.3.00.0030.03012.79

preferences:
45.86 ms | 401 KiB | 5 Q