3v4l.org

run code in 300+ PHP versions simultaneously
<?php $hotels = [ ['pataya', 3, 8.2, 8806], ['Areka', 3, 8.2, 11227], ['Serene', 4, 8.1, 13942], ['Intemate', 4, 8.0, 15307], ['Discovery', 4, 8.0, 15950], ['LK', 4, 8.2, 17773], ['Pulmann', 5, 8.0, 20562], ['Rebit', 4, 8.7, 20730], ['Avalon', 4, 8.5, 21280], ['Inn', 4, 8.4, 28983], ['Royal', 5, 8.1, 33000], ['Centara', 5, 8.4, 35732], ['Veyv', 5, 9.0, 41426], ]; $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.0220.00016.73
8.3.50.0070.01321.11
8.3.40.0120.00318.79
8.3.30.0150.00019.26
8.3.20.0000.00920.29
8.3.10.0040.00423.52
8.3.00.0030.00619.51
8.2.180.0060.01018.20
8.2.170.0190.00322.96
8.2.160.0100.00320.38
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0180.00326.16
8.2.120.0040.00422.39
8.2.110.0110.00019.30
8.2.100.0060.00617.97
8.2.90.0080.00019.30
8.2.80.0020.00717.97
8.2.70.0000.00917.88
8.2.60.0030.00518.05
8.2.50.0050.00318.07
8.2.40.0000.01018.41
8.2.30.0040.00418.24
8.2.20.0000.00817.74
8.2.10.0030.00518.25
8.2.00.0080.00417.92
8.1.280.0110.00425.92
8.1.270.0030.00622.14
8.1.260.0080.00026.35
8.1.250.0040.00428.09
8.1.240.0090.00021.48
8.1.230.0070.00417.64
8.1.220.0000.00817.91
8.1.210.0060.00318.77
8.1.200.0070.00317.47
8.1.190.0030.00617.60
8.1.180.0060.00318.10
8.1.170.0080.00018.91
8.1.160.0000.00722.18
8.1.150.0080.00018.77
8.1.140.0040.00417.57
8.1.130.0000.00717.89
8.1.120.0040.00417.55
8.1.110.0000.00817.49
8.1.100.0080.00017.60
8.1.90.0000.00717.62
8.1.80.0040.00417.53
8.1.70.0040.00417.46
8.1.60.0030.00617.59
8.1.50.0050.00317.52
8.1.40.0000.00817.63
8.1.30.0000.00917.77
8.1.20.0030.00517.68
8.1.10.0040.00417.56
8.1.00.0000.00817.49
8.0.300.0000.00918.77
8.0.290.0040.00417.00
8.0.280.0080.00018.57
8.0.270.0040.00417.43
8.0.260.0030.00317.45
8.0.250.0070.00017.13
8.0.240.0040.00417.04
8.0.230.0020.00516.97
8.0.220.0040.00417.06
8.0.210.0000.00817.00
8.0.200.0040.00416.97
8.0.190.0030.00516.97
8.0.180.0050.00317.04
8.0.170.0030.00616.93
8.0.160.0030.00616.86
8.0.150.0040.00416.91
8.0.140.0000.00716.86
8.0.130.0030.00313.54
8.0.120.0040.00417.00
8.0.110.0050.00216.98
8.0.100.0090.00017.13
8.0.90.0020.00516.83
8.0.80.0000.02317.06
8.0.70.0040.00416.99
8.0.60.0040.00416.99
8.0.50.0050.00216.97
8.0.30.0080.01617.26
8.0.20.0140.00617.40
8.0.10.0050.00317.02
8.0.00.0160.00517.00
7.4.330.0050.00015.00
7.4.320.0080.00016.70
7.4.300.0050.00216.72
7.4.290.0000.00716.64
7.4.280.0050.00516.64
7.4.270.0000.00716.60
7.4.260.0080.00016.65
7.4.250.0000.00716.55
7.4.240.0030.00516.58
7.4.230.0030.00316.57
7.4.220.0090.00916.73
7.4.210.0060.00916.72
7.4.200.0050.00316.56
7.4.190.0000.00716.59
7.4.160.0080.00816.65
7.4.150.0030.01517.40
7.4.140.0110.00917.86
7.4.130.0140.00716.55
7.4.120.0050.01416.67
7.4.110.0030.01616.48
7.4.100.0130.00716.73
7.4.90.0060.01316.67
7.4.80.0110.00919.39
7.4.70.0080.01116.66
7.4.60.0150.00316.53
7.4.50.0040.00416.65
7.4.40.0100.00722.77
7.4.30.0060.01016.77
7.4.00.0070.01114.95
7.3.330.0030.00313.43
7.3.320.0000.00513.33
7.3.310.0030.00516.28
7.3.300.0080.00016.43
7.3.290.0090.01216.38
7.3.280.0100.00916.49
7.3.270.0130.00917.40
7.3.260.0170.00316.80
7.3.250.0120.00716.65
7.3.240.0120.00916.41
7.3.230.0030.01416.78
7.3.210.0100.01016.69
7.3.200.0120.00919.39
7.3.190.0150.00916.46
7.3.180.0110.01416.59
7.3.170.0070.01016.72
7.3.160.0050.01116.79
7.3.120.0100.00614.96
7.3.110.0100.01014.95
7.3.100.0000.01214.86
7.3.90.0110.00415.15
7.3.80.0070.01014.88
7.3.70.0000.01114.87
7.3.60.0030.01014.90
7.3.50.0060.00615.00
7.3.40.0000.01514.59
7.3.30.0060.00614.97
7.3.20.0080.00416.71
7.3.10.0070.00916.61
7.3.00.0080.00816.56
7.2.330.0200.00316.89
7.2.320.0110.00716.84
7.2.310.0070.01016.77
7.2.300.0100.01016.83
7.2.290.0060.01316.66
7.2.250.0070.01315.27
7.2.240.0040.01514.95
7.2.230.0070.00714.92
7.2.220.0030.01015.29
7.2.210.0070.01015.05
7.2.200.0060.00615.15
7.2.190.0000.01015.11
7.2.180.0090.00615.18
7.2.170.0120.00614.98
7.2.130.0130.00916.43
7.2.120.0140.00816.65
7.2.110.0130.01716.27
7.2.100.0070.01515.90
7.2.90.0150.00416.78
7.2.80.0070.01416.55
7.2.70.0150.00416.61
7.2.60.0120.00316.48
7.2.50.0160.01316.34
7.2.40.0240.00716.42
7.2.30.0210.01416.89
7.2.20.0200.00716.79
7.2.10.0130.01616.71
7.2.00.0110.01118.23
7.1.330.0030.00915.84
7.1.320.0030.00615.73
7.1.310.0040.01215.88
7.1.300.0030.00615.96
7.1.290.0030.01215.64
7.1.280.0000.00915.67
7.1.270.0060.00915.53
7.1.260.0070.00715.64
7.1.250.0160.00315.63
7.1.100.0070.00317.67
7.1.70.0040.00417.16
7.1.60.0060.01619.33
7.1.50.0070.01417.02
7.1.00.0000.07322.36
7.0.200.0350.00414.90
7.0.140.0130.06322.18
7.0.100.0070.06020.04
7.0.90.0070.08319.98
7.0.80.0130.07020.05
7.0.70.0070.04020.05
7.0.60.0000.06320.07
7.0.50.0200.07020.37
7.0.40.0070.04320.20
7.0.30.0000.04720.07
7.0.20.0030.05720.18
7.0.10.0000.04320.14
7.0.00.0070.04020.06
5.6.280.0030.07720.80
5.6.250.0130.06720.64
5.6.240.0000.04720.77
5.6.230.0100.07320.65
5.6.220.0070.04720.63
5.6.210.0070.04720.79
5.6.200.0100.04721.14
5.6.190.0070.03721.05
5.6.180.0000.07020.96
5.6.170.0000.04020.98
5.6.160.0030.04321.10
5.6.150.0070.03721.05
5.6.140.0030.04321.10
5.6.130.0100.08321.19
5.6.120.0000.05021.13
5.6.110.0030.05320.97
5.6.100.0100.08021.03
5.6.90.0070.08021.08
5.6.80.0030.04020.48
5.6.70.0100.05320.33
5.6.60.0000.04020.50
5.6.50.0030.04020.34
5.6.40.0100.03020.39
5.6.30.0100.07320.33
5.6.20.0000.05720.45
5.6.10.0100.04020.37
5.6.00.0070.07320.37
5.5.380.0130.08020.42
5.5.370.0100.03320.39
5.5.360.0070.03720.38
5.5.350.0070.04020.41
5.5.340.0230.06720.94
5.5.330.0070.03720.93
5.5.320.0070.03720.91
5.5.310.0030.04320.95
5.5.300.0070.03720.88
5.5.290.0030.03720.94
5.5.280.0200.06020.95
5.5.270.0070.08320.84
5.5.260.0100.04020.83
5.5.250.0030.07320.67
5.5.240.0100.04020.32
5.5.230.0070.04020.31
5.5.220.0070.04020.27
5.5.210.0100.05320.16
5.5.200.0000.06720.27
5.5.190.0030.06320.02
5.5.180.0100.03020.29
5.5.160.0030.05020.28
5.5.150.0030.04320.27
5.5.140.0170.05720.29
5.5.130.0100.08020.13
5.5.120.0130.07720.23
5.5.110.0030.07720.13
5.5.100.0030.04020.04
5.5.90.0070.06320.13
5.5.80.0030.07720.18
5.5.70.0070.04720.05
5.5.60.0070.03720.07
5.5.50.0000.04320.18
5.5.40.0070.03720.01
5.5.30.0000.04320.05
5.5.20.0100.03320.04
5.5.10.0070.04320.05
5.5.00.0030.03720.07
5.4.450.0030.03719.29
5.4.440.0100.05719.50
5.4.430.0130.07719.50
5.4.420.0030.07719.45
5.4.410.0000.05719.15
5.4.400.0030.05719.30
5.4.390.0070.04018.96
5.4.380.0030.03719.18
5.4.370.0100.04718.96
5.4.360.0030.07019.04
5.4.350.0200.02019.11
5.4.340.0130.05719.05
5.4.320.0070.06019.03
5.4.310.0070.06318.91
5.4.300.0130.07319.18
5.4.290.0070.07718.91
5.4.280.0000.04319.19
5.4.270.0100.07719.22
5.4.260.0030.04319.02
5.4.250.0100.05319.13
5.4.240.0130.05318.90
5.4.230.0070.06019.23
5.4.220.0070.03719.08
5.4.210.0000.04319.28
5.4.200.0030.04319.07
5.4.190.0170.02719.20
5.4.180.0070.03719.20
5.4.170.0000.04019.11
5.4.160.0030.03719.11
5.4.150.0000.03318.89
5.4.140.0100.03316.37
5.4.130.0070.04716.39
5.4.120.0070.02716.52
5.4.110.0000.03716.50
5.4.100.0030.03016.49
5.4.90.0000.03316.33
5.4.80.0000.03316.50
5.4.70.0030.03316.50
5.4.60.0030.03016.46
5.4.50.0070.02716.48
5.4.40.0100.02716.51
5.4.30.0030.03016.40
5.4.20.0000.03316.44
5.4.10.0070.02716.44
5.4.00.0000.03315.79
5.3.290.0100.08014.52
5.3.280.0030.04014.61
5.3.270.0030.03314.46
5.3.260.0030.03714.57
5.3.250.0030.03014.59
5.3.240.0000.03314.59
5.3.230.0070.03714.58
5.3.220.0070.03314.52
5.3.210.0000.03314.43
5.3.200.0030.03314.54
5.3.190.0170.02314.52
5.3.180.0000.03314.57
5.3.170.0030.03314.42
5.3.160.0000.03314.50
5.3.150.0000.03314.54
5.3.140.0030.03014.39
5.3.130.0070.03014.52
5.3.120.0030.03014.50
5.3.110.0030.03314.56
5.3.100.0000.03314.02
5.3.90.0030.03013.88
5.3.80.0030.03014.02
5.3.70.0000.03314.01
5.3.60.0000.03313.99
5.3.50.0000.03313.89
5.3.40.0030.03013.93
5.3.30.0030.03013.77
5.3.20.0070.02713.68
5.3.10.0030.02713.52
5.3.00.0030.02713.49
5.2.170.0000.02711.19
5.2.160.0030.02311.14
5.2.150.0000.02711.19
5.2.140.0030.02311.19
5.2.130.0100.02010.91
5.2.120.0030.02311.10
5.2.110.0100.01711.11
5.2.100.0030.02311.09
5.2.90.0030.02311.09
5.2.80.0000.02711.09
5.2.70.0000.02711.09
5.2.60.0000.02711.11
5.2.50.0000.02711.07
5.2.40.0000.02710.79
5.2.30.0000.02710.93
5.2.20.0030.02310.98
5.2.10.0070.04310.92
5.2.00.0030.02310.72
5.1.60.0030.0509.83
5.1.50.0000.03710.01
5.1.40.0000.0479.98
5.1.30.0030.06010.41
5.1.20.0000.03310.27
5.1.10.0030.02010.05
5.1.00.0000.04010.11
5.0.50.0000.0379.73
5.0.40.0000.0309.73
5.0.30.0070.0509.73
5.0.20.0030.0139.73
5.0.10.0070.0339.73
5.0.00.0070.0539.73
4.4.90.0000.0139.73
4.4.80.0030.0109.73
4.4.70.0000.0139.73
4.4.60.0000.0309.73
4.4.50.0030.0339.73
4.4.40.0000.0279.73
4.4.30.0070.0339.73
4.4.20.0000.0179.73
4.4.10.0000.0379.73
4.4.00.0070.0279.73
4.3.110.0000.0139.73
4.3.100.0000.0179.73
4.3.90.0000.0209.73
4.3.80.0030.0409.73
4.3.70.0000.0209.73
4.3.60.0000.0339.73
4.3.50.0030.0279.73
4.3.40.0070.0309.73
4.3.30.0000.0179.73
4.3.20.0030.0239.73
4.3.10.0000.0179.73
4.3.00.0070.0279.73

preferences:
50.54 ms | 401 KiB | 5 Q