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[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][2]."\r\n"; if ( $price > $hotels[$j][2] ) { 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 $hotelA[4]-$hotelB[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.00718.43
8.3.50.0170.00517.61
8.3.40.0150.00618.87
8.3.30.0130.01018.89
8.3.20.0030.01218.95
8.3.10.0000.00820.65
8.3.00.0060.00317.71
8.2.180.0070.01116.63
8.2.170.0170.00022.96
8.2.160.0110.00720.35
8.2.150.0040.00424.18
8.2.140.0030.00524.66
8.2.130.0060.00326.16
8.2.120.0040.00419.95
8.2.110.0060.00321.04
8.2.100.0090.00318.03
8.2.90.0030.00719.30
8.2.80.0000.00818.05
8.2.70.0030.00617.75
8.2.60.0080.00017.93
8.2.50.0080.00018.07
8.2.40.0080.00019.95
8.2.30.0050.00218.16
8.2.20.0040.00417.85
8.2.10.0030.00617.79
8.2.00.0030.00717.90
8.1.270.0000.00724.66
8.1.260.0080.00026.35
8.1.250.0080.00028.09
8.1.240.0030.00622.66
8.1.230.0080.00420.98
8.1.220.0040.00417.74
8.1.210.0070.00318.89
8.1.200.0100.00017.35
8.1.190.0040.00417.53
8.1.180.0000.00818.10
8.1.170.0000.00818.83
8.1.160.0080.00018.82
8.1.150.0040.00418.59
8.1.140.0030.00617.45
8.1.130.0000.00717.77
8.1.120.0000.00717.40
8.1.110.0040.00417.45
8.1.100.0000.00717.36
8.1.90.0070.00017.40
8.1.80.0000.00817.39
8.1.70.0040.00417.38
8.1.60.0040.00417.61
8.1.50.0050.00317.43
8.1.40.0050.00317.61
8.1.30.0000.00817.64
8.1.20.0000.00817.71
8.1.10.0040.00417.63
8.1.00.0030.00517.59
8.0.300.0080.00019.98
8.0.290.0050.00216.75
8.0.280.0050.00318.49
8.0.270.0040.00417.30
8.0.260.0070.00016.86
8.0.250.0080.00017.09
8.0.240.0040.00717.09
8.0.230.0030.00317.02
8.0.220.0030.00316.96
8.0.210.0100.00017.04
8.0.200.0030.00516.94
8.0.190.0040.00417.04
8.0.180.0040.00417.05
8.0.170.0030.00617.04
8.0.160.0000.00817.00
8.0.150.0030.00716.90
8.0.140.0040.00416.95
8.0.130.0000.00913.39
8.0.120.0000.00716.99
8.0.110.0040.00416.84
8.0.100.0050.00216.82
8.0.90.0000.00716.87
8.0.80.0000.01616.97
8.0.70.0050.00316.85
8.0.60.0000.00816.99
8.0.50.0050.00317.11
8.0.30.0100.00917.15
8.0.20.0100.01217.29
8.0.10.0000.00817.09
8.0.00.0140.00416.81
7.4.330.0030.00313.11
7.4.320.0000.00716.58
7.4.300.0050.00216.55
7.4.290.0000.00816.57
7.4.280.0080.00316.51
7.4.270.0070.00016.48
7.4.260.0000.00713.22
7.4.250.0040.00416.55
7.4.240.0000.00716.56
7.4.230.0030.00316.62
7.4.220.0150.00616.57
7.4.210.0070.00816.52
7.4.200.0070.00016.63
7.4.190.0040.00416.73
7.4.160.0030.01416.53
7.4.150.0060.01316.70
7.4.140.0100.01016.59
7.4.130.0090.00816.59
7.4.120.0060.01316.59
7.4.110.0150.00416.39
7.4.100.0060.01116.47
7.4.90.0090.00916.45
7.4.80.0080.01416.50
7.4.70.0090.00916.60
7.4.60.0120.01216.41
7.4.50.0000.00516.42
7.4.40.0000.01116.46
7.4.30.0090.00616.44
7.4.10.0100.00814.93
7.4.00.0060.01014.96
7.3.330.0000.00613.49
7.3.320.0050.00013.41
7.3.310.0060.00316.36
7.3.300.0000.00816.47
7.3.290.0100.01016.52
7.3.280.0080.01016.46
7.3.270.0040.01516.59
7.3.260.0140.00616.40
7.3.250.0120.00616.46
7.3.240.0070.01116.49
7.3.230.0030.01316.68
7.3.210.0070.01016.45
7.3.200.0110.01419.39
7.3.190.0130.01016.40
7.3.180.0120.00916.76
7.3.170.0120.00616.55
7.3.160.0130.00916.39
7.3.130.0100.00915.09
7.3.120.0090.01015.02
7.3.110.0060.01114.87
7.3.100.0040.00614.89
7.3.90.0100.00414.73
7.3.80.0060.00814.86
7.3.70.0060.00614.98
7.3.60.0050.00714.91
7.3.50.0060.00714.90
7.3.40.0060.00514.76
7.3.30.0040.00714.99
7.3.20.0080.00816.71
7.3.10.0080.00816.45
7.3.00.0060.00716.75
7.2.330.0090.01016.78
7.2.320.0060.01616.57
7.2.310.0170.00716.45
7.2.300.0110.01116.86
7.2.290.0090.00916.47
7.2.260.0070.00715.08
7.2.250.0060.01214.77
7.2.240.0070.00915.14
7.2.230.0060.01015.13
7.2.220.0090.00615.34
7.2.210.0060.00715.10
7.2.200.0070.00715.11
7.2.190.0060.00814.99
7.2.180.0040.00815.11
7.2.170.0030.00914.98
7.2.160.0070.00515.11
7.2.150.0020.01216.93
7.2.140.0030.00816.77
7.2.130.0070.00616.81
7.2.120.0010.01317.04
7.2.110.0070.00616.88
7.2.100.0060.00916.78
7.2.90.0070.00716.97
7.2.80.0090.00516.79
7.2.70.0050.00916.98
7.2.60.0070.00716.90
7.2.50.0000.01316.94
7.2.40.0050.00616.88
7.2.30.0070.00717.05
7.2.20.0100.00616.82
7.2.10.0030.01216.86
7.2.00.0030.01117.44
7.1.330.0060.00815.82
7.1.320.0070.00715.73
7.1.310.0030.00815.79
7.1.300.0020.01115.71
7.1.290.0060.00815.66
7.1.280.0060.00615.74
7.1.270.0030.01115.78
7.1.260.0060.00615.79
7.1.250.0060.00815.80
7.1.240.0020.01015.93
7.1.230.0020.01015.87
7.1.220.0140.00215.83
7.1.210.0070.00815.82
7.1.200.0090.00315.87
7.1.190.0120.00315.87
7.1.180.0020.01015.71
7.1.170.0040.00715.79
7.1.160.0090.00315.78
7.1.150.0070.00515.76
7.1.140.0050.01015.80
7.1.130.0030.00815.96
7.1.120.0000.01215.76
7.1.110.0030.00615.90
7.1.100.0070.00516.74
7.1.90.0030.01015.89
7.1.80.0050.01015.84
7.1.70.0050.00716.32
7.1.60.0050.01216.96
7.1.50.0070.00916.17
7.1.40.0060.00515.64
7.1.30.0030.01015.94
7.1.20.0120.00415.77
7.1.10.0020.00915.93
7.1.00.0080.02517.97
7.0.330.0040.00515.50
7.0.320.0040.00515.38
7.0.310.0050.00515.60
7.0.300.0030.01015.49
7.0.290.0050.00915.43
7.0.280.0040.01215.59
7.0.270.0070.00315.38
7.0.260.0070.00715.41
7.0.250.0060.00815.38
7.0.240.0060.00515.53
7.0.230.0030.01115.17
7.0.220.0070.00715.46
7.0.210.0050.00615.52
7.0.200.0040.00915.92
7.0.190.0030.00815.43
7.0.180.0040.00815.39
7.0.170.0030.00715.39
7.0.160.0100.00515.20
7.0.150.0050.00915.39
7.0.140.0050.02917.67
7.0.130.0050.00515.41
7.0.120.0060.02317.65
7.0.110.0060.00615.50
7.0.100.0020.01315.42
7.0.90.0100.00515.54
7.0.80.0020.01315.53
7.0.70.0050.00815.43
7.0.60.0070.03116.98
7.0.50.0040.02416.22
7.0.40.0060.01914.76
7.0.30.0080.03214.90
7.0.20.0050.02214.92
7.0.10.0040.03214.91
7.0.00.0060.01714.93
5.6.400.0060.01014.41
5.6.390.0060.01014.54
5.6.380.0040.01014.62
5.6.370.0040.01214.42
5.6.360.0050.00914.44
5.6.350.0000.01114.53
5.6.340.0030.01314.37
5.6.330.0020.00914.53
5.6.320.0030.01014.35
5.6.310.0020.00814.57
5.6.300.0080.00614.57
5.6.290.0060.00914.32
5.6.280.0070.03116.71
5.6.270.0060.00814.36
5.6.260.0070.00714.47
5.6.250.0080.01014.33
5.6.240.0070.00714.48
5.6.230.0050.01114.35
5.6.220.0010.01014.34
5.6.210.0070.03016.50
5.6.200.0040.03415.67
5.6.190.0060.02115.74
5.6.180.0050.03115.69
5.6.170.0060.02215.71
5.6.160.0030.02015.68
5.6.150.0090.02015.62
5.6.140.0070.02715.77
5.6.130.0070.02515.64
5.6.120.0100.02915.73
5.6.110.0110.02915.70
5.6.100.0060.03515.69
5.6.90.0050.03215.60
5.6.80.0060.02315.49
5.6.70.0050.03415.47
5.6.60.0010.03615.40
5.6.50.0050.02515.53
5.6.40.0070.02215.39
5.6.30.0060.02615.47
5.6.20.0060.01915.33
5.6.10.0070.02415.29
5.6.00.0020.02215.37
5.5.380.0040.01114.45
5.5.370.0050.00914.41
5.5.360.0070.00314.42
5.5.350.0170.02416.46
5.5.340.0060.03215.79
5.5.330.0060.02015.50
5.5.320.0080.02315.66
5.5.310.0080.02415.77
5.5.300.0080.02515.63
5.5.290.0090.02115.73
5.5.280.0050.03415.54
5.5.270.0060.03015.54
5.5.260.0060.02815.47
5.5.250.0050.02915.63
5.5.240.0070.02615.44
5.5.230.0050.02415.35
5.5.220.0040.02915.15
5.5.210.0060.01915.41
5.5.200.0040.03515.32
5.5.190.0090.02815.39
5.5.180.0090.03115.34
5.5.170.0030.01314.18
5.5.160.0060.01915.32
5.5.150.0070.03315.09
5.5.140.0070.02715.25
5.5.130.0090.02115.44
5.5.120.0070.03215.20
5.5.110.0080.01615.31
5.5.100.0010.03715.27
5.5.90.0030.03215.23
5.5.80.0010.02815.26
5.5.70.0080.02815.29
5.5.60.0070.02915.36
5.5.50.0050.03315.21
5.5.40.0060.02515.18
5.5.30.0070.03015.29
5.5.20.0080.02815.41
5.5.10.0100.02715.10
5.5.00.0050.03215.13
5.4.450.0030.02113.93
5.4.440.0070.03213.84
5.4.430.0100.02913.95
5.4.420.0030.03613.99
5.4.410.0020.02714.01
5.4.400.0080.02713.90
5.4.390.0060.02113.79
5.4.380.0050.02013.88
5.4.370.0040.03013.73
5.4.360.0080.02713.83
5.4.350.0080.02913.72
5.4.340.0080.01613.82
5.4.330.0110.00111.20
5.4.320.0090.02613.89
5.4.310.0070.03113.68
5.4.300.0050.03113.71
5.4.290.0080.02913.97
5.4.280.0060.02213.67
5.4.270.0050.02813.84
5.4.260.0050.03313.79
5.4.250.0030.02613.83
5.4.240.0060.02413.85
5.4.230.0080.02913.65
5.4.220.0060.02213.93
5.4.210.0090.02913.71
5.4.200.0080.02813.81
5.4.190.0040.03013.76
5.4.180.0030.03113.67
5.4.170.0090.02113.75
5.4.160.0070.02413.87
5.4.150.0060.03013.78
5.4.140.0050.03113.01
5.4.130.0060.01412.90
5.4.120.0030.03113.04
5.4.110.0060.02412.94
5.4.100.0030.02712.99
5.4.90.0040.02812.98
5.4.80.0020.02912.95
5.4.70.0070.01912.95
5.4.60.0080.01112.81
5.4.50.0020.01912.96
5.4.40.0070.02612.98
5.4.30.0050.02013.01
5.4.20.0030.02912.84
5.4.10.0070.02612.99
5.4.00.0050.01912.81
5.3.290.0070.02212.00
5.3.280.0050.03111.98
5.3.270.0060.02111.99
5.3.260.0050.01811.97
5.3.250.0010.03012.00
5.3.240.0060.02811.94
5.3.230.0030.03112.00
5.3.220.0050.01512.02
5.3.210.0040.03111.90
5.3.200.0010.03011.93
5.3.190.0060.02511.96
5.3.180.0050.02112.05
5.3.170.0020.02412.02
5.3.160.0050.01512.00
5.3.150.0070.01412.03
5.3.140.0060.02711.95
5.3.130.0060.01411.92
5.3.120.0050.03012.01
5.3.110.0030.02612.01
5.3.100.0030.01811.84
5.3.90.0010.02711.84
5.3.80.0080.01411.73
5.3.70.0030.02911.75
5.3.60.0020.03111.77
5.3.50.0040.01911.68
5.3.40.0060.02611.76
5.3.30.0040.02511.69
5.3.20.0060.01611.67
5.3.10.0020.02711.55
5.3.00.0070.02511.55
5.2.170.0070.05711.14
5.2.160.0030.05011.14
5.2.150.0000.07011.09
5.2.140.0000.04711.09
5.2.130.0070.06311.00
5.2.120.0170.05311.06
5.2.110.0030.05011.08
5.2.100.0000.05311.13
5.2.90.0100.05311.08
5.2.80.0000.07011.09
5.2.70.0100.05711.08
5.2.60.0030.06311.00
5.2.50.0130.05310.96
5.2.40.0070.04011.03
5.2.30.0030.06010.90
5.2.20.0100.03010.74
5.2.10.0130.05010.89
5.2.00.0030.06010.75
5.1.60.0070.0509.94
5.1.50.0030.05310.14
5.1.40.0000.0379.93
5.1.30.0070.04710.27
5.1.20.0100.05310.27
5.1.10.0070.05310.21
5.1.00.0030.03710.10
5.0.50.0000.0278.47
5.0.40.0030.0408.39
5.0.30.0000.0538.19
5.0.20.0070.0378.25
5.0.10.0070.0178.00
5.0.00.0000.0408.07
4.4.90.0030.0377.86
4.4.80.0000.0337.86
4.4.70.0000.0377.86
4.4.60.0000.0407.86
4.4.50.0000.0377.86
4.4.40.0070.0537.86
4.4.30.0030.0277.86
4.4.20.0000.0337.86
4.4.10.0030.0177.86
4.4.00.0000.0577.86
4.3.110.0030.0307.86
4.3.100.0070.0307.86
4.3.90.0030.0207.86
4.3.80.0000.0577.86
4.3.70.0030.0337.86
4.3.60.0070.0307.86
4.3.50.0030.0277.86
4.3.40.0000.0577.86
4.3.30.0000.0377.86
4.3.20.0000.0207.86
4.3.10.0030.0337.86
4.3.00.0000.0377.86

preferences:
54.9 ms | 400 KiB | 5 Q