3v4l.org

run code in 300+ PHP versions simultaneously
<?php $hotels = [ ['Polirisos', 3, 8.2, 13032], ['Triton', 4, 8.6, 13032], ['Melisa', 3, 8.1, 16289], ['Panormo', 3, 8.9, 17593], ['Horizon', 3, 8.7, 17593], ['Aliantes', 3, 8.7, 20851], ['Kurifi', 4, 8.6, 21991], ['Mari', 3, 8.5, 22154], ['Astron', 3, 8.9, 22479], ]; $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.0090.00616.63
8.3.50.0130.00821.21
8.3.40.0160.00318.96
8.3.30.0140.00019.18
8.3.20.0040.00420.32
8.3.10.0040.00423.47
8.3.00.0040.00419.38
8.2.180.0160.00416.38
8.2.170.0120.00922.96
8.2.160.0030.01020.49
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0080.00022.21
8.2.110.0040.00422.23
8.2.100.0040.00817.84
8.2.90.0040.00419.20
8.2.80.0000.00817.97
8.2.70.0030.00617.63
8.2.60.0000.00917.93
8.2.50.0060.00318.07
8.2.40.0050.00318.41
8.2.30.0020.00518.38
8.2.20.0050.00317.93
8.2.10.0000.00718.23
8.2.00.0060.00617.98
8.1.280.0120.00925.92
8.1.270.0030.00723.99
8.1.260.0000.00826.35
8.1.250.0050.00328.09
8.1.240.0000.00824.09
8.1.230.0000.01219.28
8.1.220.0000.00817.74
8.1.210.0000.00818.77
8.1.200.0030.00717.35
8.1.190.0030.00517.66
8.1.180.0050.00318.10
8.1.170.0000.00818.78
8.1.160.0040.00422.12
8.1.150.0060.00318.63
8.1.140.0000.00717.57
8.1.130.0040.00417.48
8.1.120.0050.00317.50
8.1.110.0000.00717.46
8.1.100.0000.00717.55
8.1.90.0050.00217.57
8.1.80.0000.00817.57
8.1.70.0040.00417.48
8.1.60.0090.00017.64
8.1.50.0000.00817.61
8.1.40.0050.00317.52
8.1.30.0030.00517.71
8.1.20.0050.00317.66
8.1.10.0040.00417.51
8.1.00.0040.00417.48
8.0.300.0000.00818.77
8.0.290.0070.00017.29
8.0.280.0000.00718.60
8.0.270.0060.00317.36
8.0.260.0000.00716.84
8.0.250.0040.00416.98
8.0.240.0070.00017.05
8.0.230.0040.00416.95
8.0.220.0000.00717.05
8.0.210.0040.00416.92
8.0.200.0030.00317.03
8.0.190.0000.00816.96
8.0.180.0000.00717.03
8.0.170.0040.00417.03
8.0.160.0070.00017.00
8.0.150.0000.00816.94
8.0.140.0000.00817.00
8.0.130.0030.00313.43
8.0.120.0080.00017.02
8.0.110.0050.00316.95
8.0.100.0040.00417.03
8.0.90.0000.00716.81
8.0.80.0100.00716.96
8.0.70.0000.00816.82
8.0.60.0050.00316.87
8.0.50.0000.00816.84
8.0.30.0130.00717.29
8.0.20.0030.01617.40
8.0.10.0050.00217.01
8.0.00.0160.00616.85
7.4.330.0050.00015.14
7.4.320.0040.00416.70
7.4.300.0030.00316.76
7.4.290.0050.00216.63
7.4.280.0060.00316.50
7.4.270.0050.00216.64
7.4.260.0030.00316.61
7.4.250.0040.00416.73
7.4.240.0040.00316.56
7.4.230.0070.00016.79
7.4.220.0070.01016.62
7.4.210.0110.00316.74
7.4.200.0040.00416.52
7.4.190.0070.00016.68
7.4.160.0100.00716.59
7.4.150.0130.00917.40
7.4.140.0080.01317.86
7.4.130.0070.01116.69
7.4.120.0180.00416.59
7.4.110.0110.00816.61
7.4.100.0060.01216.67
7.4.90.0070.01716.66
7.4.80.0140.01219.39
7.4.70.0080.01116.63
7.4.60.0150.00316.57
7.4.50.0030.00516.54
7.4.40.0060.00922.77
7.4.30.0060.01016.68
7.4.00.0050.01215.07
7.3.330.0000.00613.46
7.3.320.0030.00313.45
7.3.310.0000.00716.36
7.3.300.0040.00416.42
7.3.290.0110.00316.37
7.3.280.0130.00916.44
7.3.270.0150.00317.40
7.3.260.0120.01016.52
7.3.250.0100.01216.53
7.3.240.0130.00616.58
7.3.230.0120.00616.52
7.3.210.0130.00316.75
7.3.200.0090.00919.39
7.3.190.0090.00916.49
7.3.180.0120.00316.52
7.3.170.0170.00016.59
7.3.160.0060.01016.52
7.3.120.0070.01115.19
7.3.10.0040.00816.52
7.3.00.0080.00416.57
7.2.330.0130.00616.86
7.2.320.0090.01016.94
7.2.310.0090.00916.73
7.2.300.0110.00716.84
7.2.290.0100.01116.70
7.2.130.0080.00416.91
7.2.120.0030.01416.75
7.2.110.0040.01416.82
7.2.100.0090.00616.77
7.2.90.0120.00616.91
7.2.80.0030.00916.86
7.2.70.0070.01016.76
7.2.60.0100.00616.83
7.2.50.0160.00317.09
7.2.40.0000.01016.93
7.2.30.0060.01017.07
7.2.20.0110.00516.80
7.2.10.0130.00517.11
7.2.00.0060.01218.25
7.1.250.0090.00615.93
7.1.200.0060.00315.83
7.1.100.0000.01118.14
7.1.70.0070.00317.03
7.1.60.0000.02419.33
7.1.50.0190.01634.96
7.1.00.0100.07722.35
7.0.200.0650.00714.80
7.0.140.0070.07022.08
7.0.60.0170.07720.05
7.0.50.0070.08017.92
7.0.40.0130.08320.11
7.0.30.0200.05320.06
7.0.20.0300.07320.12
7.0.10.0070.09020.23
7.0.00.0100.08020.30
5.6.280.0100.06320.89
5.6.210.0030.08720.73
5.6.200.0130.07718.28
5.6.190.0070.04720.39
5.6.180.0270.03720.48
5.6.170.0200.06720.46
5.6.160.0100.05020.47
5.6.150.0070.04018.17
5.6.140.0100.07718.21
5.6.130.0070.05718.13
5.6.120.0030.07021.03
5.6.110.0130.08021.02
5.6.100.0270.07021.05
5.6.90.0170.08320.99
5.6.80.0070.08320.39
5.6.70.2030.04720.29
5.5.350.0170.06320.51
5.5.340.0100.07318.04
5.5.330.0130.07720.21
5.5.320.0070.08320.25
5.5.310.0170.05020.40
5.5.300.0070.03718.04
5.5.290.0030.05017.99
5.5.280.0130.07720.80
5.5.270.0100.08320.82
5.5.260.0030.08720.89
5.5.250.0030.08020.60
5.5.240.0200.07020.12
5.4.450.0130.06319.64
5.4.440.0800.06719.44
5.4.430.0800.06019.32
5.4.420.0600.07719.64
5.4.410.0700.05319.04
5.4.400.0870.04718.89
5.4.390.0900.05719.32
5.4.380.0230.06018.81
5.4.370.0530.07318.80
5.4.360.0230.08018.49
5.4.350.0370.07718.65
5.4.340.0200.06318.49
5.4.320.0080.03612.53
5.4.310.0070.04112.53
5.4.300.0090.03712.54
5.4.290.0060.03912.52
5.4.280.0200.07612.39
5.4.270.0130.05212.39
5.4.260.0120.05912.40
5.4.250.0100.06512.40
5.4.240.0130.05712.40
5.4.230.0220.07912.39
5.4.220.0110.08012.39
5.4.210.0100.05512.39
5.4.200.0180.07212.39
5.4.190.0120.07512.39
5.4.180.0150.04512.38
5.4.170.0110.05612.40
5.4.160.0170.05712.39
5.4.150.0280.08412.39
5.4.140.0150.07612.07
5.4.130.0230.07812.06
5.4.120.0130.07312.02
5.4.110.0190.08612.02
5.4.100.0130.07312.02
5.4.90.0130.07312.02
5.4.80.0250.09012.02
5.4.70.0110.05112.01
5.4.60.0180.05612.02
5.4.50.0170.05512.01
5.4.40.0180.05712.00
5.4.30.0110.05912.00
5.4.20.0070.06312.00
5.4.10.0130.05412.00
5.4.00.0140.06011.49
5.3.290.0080.04412.80
5.3.280.0080.05512.70
5.3.270.0140.06312.73
5.3.260.0230.08512.72
5.3.250.0200.08012.72
5.3.240.0250.08012.72
5.3.230.0280.07012.71
5.3.220.0150.07212.68
5.3.210.0170.07912.68
5.3.200.0160.05312.68
5.3.190.0210.11312.68
5.3.180.0460.09412.68
5.3.170.0210.07312.66
5.3.160.0100.04312.68
5.3.150.0110.03712.67
5.3.140.0140.04612.66
5.3.130.0130.05312.66
5.3.120.0070.05112.66
5.3.110.0100.03612.66
5.3.100.0070.03912.12
5.3.90.0200.07212.08
5.3.80.0370.09112.07
5.3.70.0140.04112.07
5.3.60.0500.09112.06
5.3.50.0150.06812.00
5.3.40.0210.05212.00
5.3.30.0110.11311.94
5.3.20.0110.05911.70
5.3.10.0220.07411.67
5.3.00.0600.16811.66
5.2.170.0150.0709.16
5.2.160.0210.0619.15
5.2.150.0120.0549.15
5.2.140.0080.0419.15
5.2.130.0120.0599.11
5.2.120.0050.0479.11
5.2.110.0100.0339.11
5.2.100.0160.0529.11
5.2.90.0100.0449.11
5.2.80.0070.0349.11
5.2.70.0080.0409.11
5.2.60.0060.0409.06
5.2.50.0110.0369.03
5.2.40.0080.0319.00
5.2.30.0070.0318.98
5.2.20.0090.0338.97
5.2.10.0080.0288.90
5.2.00.0090.0388.76
5.1.60.0060.0338.05
5.1.50.0090.0338.04
5.1.40.0080.0498.03
5.1.30.0090.0418.38
5.1.20.0210.0788.40
5.1.10.0240.0538.13
5.1.00.0080.0388.13
5.0.50.0060.0276.60
5.0.40.0200.0426.46
5.0.30.0110.0626.27
5.0.20.0030.0306.24
5.0.10.0170.0356.22
5.0.00.0080.0586.21
4.4.90.0100.0354.78
4.4.80.0040.0234.75
4.4.70.0040.0304.75
4.4.60.0100.0314.76
4.4.50.0090.0304.77
4.4.40.0040.0374.71
4.4.30.0050.0274.76
4.4.20.0160.0414.85
4.4.10.0030.0234.85
4.4.00.0070.0254.76
4.3.110.0070.0184.67
4.3.100.0100.0454.66
4.3.90.0190.0364.64
4.3.80.0070.0574.58
4.3.70.0090.0464.63
4.3.60.0060.0404.63
4.3.50.0110.0404.63
4.3.40.0070.0254.54
4.3.30.0020.0183.27
4.3.20.0020.0203.25
4.3.10.0060.0183.21
4.3.00.0030.01710.37

preferences:
35.45 ms | 401 KiB | 5 Q