3v4l.org

run code in 300+ PHP versions simultaneously
<?php $hotels = [ ['sistina', 4, 8.2, 31055], ['Agustino', 4, 8.3, 31555], ['Evrostars', 4, 8.1, 32178], ['Larovere', 4, 8.2, 33137], ['Rex', 4, 8.0, 33789], ['Ludovici', 4, 8.1, 33929], ['Guilio', 4, 8.4, 34208], ['NH', 4, 8.6, 34403], ['Napoleon', 4, 8.3, 34906], ['Bittiya', 4, 8.1, 35446], ['La redidenza', 4, 8.9, 37446], ]; $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.40.0120.00318.92
8.3.30.0110.00419.22
8.3.20.0080.00020.34
8.3.10.0050.00323.65
8.3.00.0000.00819.50
8.2.170.0100.00622.96
8.2.160.0140.00020.52
8.2.150.0050.00324.18
8.2.140.0040.00424.66
8.2.130.0080.00026.16
8.2.120.0040.00422.27
8.2.110.0050.00522.37
8.2.100.0120.00017.84
8.2.90.0040.00419.36
8.2.80.0080.00018.02
8.2.70.0050.00317.63
8.2.60.0100.00317.93
8.2.50.0000.00818.07
8.2.40.0000.00818.28
8.2.30.0040.00418.18
8.2.20.0030.00517.91
8.2.10.0020.00518.17
8.2.00.0000.00917.86
8.1.270.0080.00022.39
8.1.260.0000.00826.35
8.1.250.0000.00728.09
8.1.240.0100.00023.95
8.1.230.0000.01219.27
8.1.220.0000.00817.89
8.1.210.0050.00318.77
8.1.200.0070.00317.60
8.1.190.0060.00317.54
8.1.180.0030.00518.10
8.1.170.0060.00318.91
8.1.160.0040.00422.11
8.1.150.0040.00418.68
8.1.140.0000.00717.49
8.1.130.0050.00218.02
8.1.120.0040.00417.52
8.1.110.0040.00417.58
8.1.100.0040.00417.48
8.1.90.0040.00417.54
8.1.80.0040.00417.49
8.1.70.0040.00417.43
8.1.60.0030.00617.74
8.1.50.0030.00617.57
8.1.40.0040.00417.68
8.1.30.0090.00017.59
8.1.20.0050.00217.69
8.1.10.0030.00517.70
8.1.00.0040.00417.58
8.0.300.0070.00018.77
8.0.290.0000.00717.30
8.0.280.0050.00318.42
8.0.270.0030.00517.26
8.0.260.0030.00317.30
8.0.250.0000.00817.08
8.0.240.0040.00417.11
8.0.230.0050.00217.03
8.0.220.0070.00017.02
8.0.210.0000.00717.05
8.0.200.0030.00317.07
8.0.190.0000.00717.14
8.0.180.0000.00817.10
8.0.170.0000.00817.01
8.0.160.0040.00417.00
8.0.150.0040.00416.96
8.0.140.0050.00316.96
8.0.130.0060.00013.38
8.0.120.0000.00816.95
8.0.110.0000.00717.00
8.0.100.0030.00517.13
8.0.90.0070.00017.05
8.0.80.0090.00616.89
8.0.70.0040.00416.96
8.0.60.0000.00816.97
8.0.50.0040.00417.07
8.0.30.0120.00817.29
8.0.20.0140.00817.40
8.0.10.0000.00717.02
8.0.00.0100.01216.71
7.4.330.0000.00515.00
7.4.320.0030.00316.71
7.4.300.0070.00016.63
7.4.290.0000.00716.57
7.4.280.0040.00416.72
7.4.270.0040.00416.73
7.4.260.0040.00416.53
7.4.250.0040.00416.68
7.4.240.0030.00416.72
7.4.230.0000.00716.81
7.4.220.0040.01516.66
7.4.210.0080.00816.66
7.4.200.0000.00716.81
7.4.190.0000.00716.86
7.4.160.0090.00916.58
7.4.150.0180.00217.40
7.4.140.0090.01117.86
7.4.130.0090.00916.66
7.4.120.0080.01016.57
7.4.110.0120.00616.44
7.4.100.0120.00816.84
7.4.90.0170.00316.70
7.4.80.0100.01319.39
7.4.70.0090.00916.62
7.4.60.0070.01016.54
7.4.50.0000.00616.70
7.4.40.0070.00722.77
7.4.30.0100.01016.72
7.4.10.0060.01214.93
7.4.00.0060.01015.12
7.3.330.0000.00713.49
7.3.320.0050.00013.27
7.3.310.0040.00416.28
7.3.300.0050.00316.48
7.3.290.0060.00916.47
7.3.280.0070.01016.48
7.3.270.0050.01317.40
7.3.260.0210.00416.40
7.3.250.0140.00716.61
7.3.240.0090.01216.63
7.3.230.0150.00316.62
7.3.210.0000.01716.47
7.3.200.0140.01119.39
7.3.190.0120.00616.73
7.3.180.0000.01616.57
7.3.170.0000.01716.61
7.3.160.0030.01416.70
7.3.130.0100.00714.95
7.3.120.0030.01514.81
7.3.110.0110.01014.87
7.3.100.0020.01315.02
7.3.90.0070.00714.77
7.3.80.0040.01114.92
7.3.70.0080.00714.84
7.3.60.0060.00914.93
7.3.50.0090.00514.96
7.3.40.0060.00614.77
7.3.30.0080.00614.70
7.3.20.0060.00616.61
7.3.10.0100.00516.45
7.3.00.0080.00616.66
7.2.330.0120.01516.78
7.2.320.0130.00716.70
7.2.310.0080.01116.87
7.2.300.0110.00716.93
7.2.290.0090.01116.86
7.2.260.0040.01515.26
7.2.250.0130.00715.05
7.2.240.0080.00815.09
7.2.230.0100.00815.09
7.2.220.0070.00715.09
7.2.210.0040.00915.18
7.2.200.0070.00814.99
7.2.190.0050.01015.14
7.2.180.0080.00515.16
7.2.170.0080.00615.19
7.2.160.0030.01515.03
7.2.150.0090.00716.95
7.2.140.0050.01116.94
7.2.130.0050.00816.93
7.2.120.0120.00316.91
7.2.110.0080.00616.79
7.2.100.0070.00716.99
7.2.90.0060.00916.79
7.2.80.0060.01016.90
7.2.70.0100.00716.80
7.2.60.0080.00616.83
7.2.50.0060.00816.90
7.2.40.0060.01016.99
7.2.30.0060.00816.93
7.2.20.0050.01016.78
7.2.10.0100.00316.85
7.2.00.0080.00917.44
7.1.330.0080.00815.76
7.1.320.0070.00515.80
7.1.310.0030.00615.73
7.1.300.0040.01115.77
7.1.290.0070.00815.76
7.1.280.0110.00415.88
7.1.270.0070.00715.76
7.1.260.0060.00815.85
7.1.250.0050.00915.68
7.1.240.0060.00915.71
7.1.230.0040.01115.93
7.1.220.0030.01215.87
7.1.210.0030.01015.95
7.1.200.0080.00415.90
7.1.190.0060.01015.62
7.1.180.0070.01015.83
7.1.170.0080.00315.88
7.1.160.0070.00715.76
7.1.150.0000.01415.99
7.1.140.0080.00815.57
7.1.130.0100.00315.65
7.1.120.0040.00415.45
7.1.110.0070.01015.97
7.1.100.0060.01016.88
7.1.90.0030.01115.98
7.1.80.0030.00715.96
7.1.70.0030.01016.34
7.1.60.0050.01517.56
7.1.50.0130.01025.35
7.1.40.0030.01015.75
7.1.30.0060.00915.90
7.1.20.0110.00415.85
7.1.10.0000.01015.77
7.1.00.0070.04019.15
7.0.330.0070.01115.44
7.0.320.0080.00615.46
7.0.310.0030.01015.32
7.0.300.0040.01115.40
7.0.290.0030.01015.28
7.0.280.0060.00915.61
7.0.270.0030.01015.50
7.0.260.0070.00415.45
7.0.250.0070.00715.23
7.0.240.0190.00015.49
7.0.230.0190.00015.63
7.0.220.0030.01015.37
7.0.210.0090.00615.54
7.0.200.0080.00315.25
7.0.190.0060.00615.14
7.0.180.0000.01315.59
7.0.170.0000.01115.24
7.0.160.0040.01115.61
7.0.150.0060.00315.44
7.0.140.0050.04018.85
7.0.130.0030.00615.31
7.0.120.0030.00615.14
7.0.110.0070.00715.32
7.0.100.0090.00615.39
7.0.90.0120.00315.48
7.0.80.0100.00315.13
7.0.70.0000.01115.59
7.0.60.0080.04517.74
7.0.50.0070.04416.76
7.0.40.0070.04116.78
7.0.30.0130.03316.80
7.0.20.0130.03616.80
7.0.10.0090.03516.87
7.0.00.0030.04916.84
5.6.400.0030.01014.38
5.6.390.0030.01014.26
5.6.380.0070.01014.20
5.6.370.0040.01214.62
5.6.360.0120.00414.39
5.6.350.0030.00614.13
5.6.340.0000.00914.74
5.6.330.0120.00314.75
5.6.320.0070.01414.30
5.6.310.0070.00714.27
5.6.300.0110.00414.54
5.6.290.0000.01614.59
5.6.280.0050.04017.60
5.6.270.0120.00314.29
5.6.260.0030.01014.39
5.6.250.0140.00314.32
5.6.240.0000.01214.35
5.6.230.0070.00314.32
5.6.220.0080.00414.75
5.6.210.0110.04017.59
5.6.200.0090.03916.36
5.6.190.0050.02917.42
5.6.180.0070.03217.60
5.6.170.0220.02817.72
5.6.160.0020.02817.49
5.6.150.0030.04416.28
5.6.140.0100.03016.20
5.6.130.0050.03216.50
5.6.120.0110.02717.55
5.6.110.0100.04517.73
5.6.100.0020.02717.72
5.6.90.0160.02817.87
5.6.80.0030.05017.40
5.6.70.1180.02217.40
5.6.60.0030.01014.55
5.6.50.0030.01014.55
5.6.40.0100.00314.41
5.6.30.0060.00314.58
5.6.20.0000.01414.41
5.6.10.0000.01014.40
5.6.00.0000.01314.38
5.5.380.0030.01014.17
5.5.370.0060.00914.20
5.5.360.0090.00914.45
5.5.350.0130.04317.37
5.5.340.0080.02116.27
5.5.330.0130.04317.30
5.5.320.0100.02817.17
5.5.310.0090.02917.32
5.5.300.0060.04616.32
5.5.290.0100.02816.17
5.5.280.0070.02217.59
5.5.270.0020.02917.66
5.5.260.0120.03717.52
5.5.250.0060.02217.44
5.5.240.0080.03217.32
5.5.230.0040.01114.46
5.5.220.0070.00714.44
5.5.210.0030.01414.36
5.5.200.0000.00914.29
5.5.190.0000.01314.12
5.5.180.0030.00614.46
5.5.170.0060.00314.12
5.5.160.0120.00314.20
5.5.150.0090.00914.47
5.5.140.0060.00914.19
5.5.130.0000.01514.54
5.5.120.0000.01614.55
5.5.110.0030.01014.33
5.5.100.0080.00814.44
5.5.90.0070.01114.57
5.5.80.0040.01114.70
5.5.70.0040.00814.50
5.5.60.0060.00914.25
5.5.50.0070.01014.21
5.5.40.0070.01014.57
5.5.30.0030.00914.55
5.5.20.0080.00414.45
5.5.10.0090.00613.92
5.5.00.0100.00314.26
5.4.450.0050.03915.67
5.4.440.0450.03615.75
5.4.430.0450.02715.68
5.4.420.0400.03115.75
5.4.410.0400.03215.70
5.4.400.0500.03015.51
5.4.390.0520.04315.57
5.4.380.0200.03915.22
5.4.370.0150.02715.29
5.4.360.0160.03115.32
5.4.350.0190.03815.19
5.4.340.0140.02815.22
5.4.330.0030.00611.88
5.4.320.0070.02512.21
5.4.310.0040.02412.21
5.4.300.0050.02712.20
5.4.290.0050.02312.20
5.4.280.0050.02512.14
5.4.270.0080.04812.14
5.4.260.0100.03812.14
5.4.250.0050.03012.14
5.4.240.0040.02512.14
5.4.230.0070.02912.14
5.4.220.0100.02912.14
5.4.210.0050.02512.14
5.4.200.0050.02412.14
5.4.190.0060.02112.14
5.4.180.0080.02912.14
5.4.170.0070.03112.14
5.4.160.0070.02412.14
5.4.150.0080.02212.14
5.4.140.0070.02411.98
5.4.130.0090.02911.97
5.4.120.0080.02811.95
5.4.110.0050.03011.95
5.4.100.0080.03011.95
5.4.90.0070.03111.95
5.4.80.0130.03311.95
5.4.70.0070.03511.95
5.4.60.0060.03311.95
5.4.50.0070.03711.95
5.4.40.0070.03211.94
5.4.30.0090.03011.94
5.4.20.0120.02511.94
5.4.10.0070.02311.94
5.4.00.0040.02511.69
5.3.290.0050.02212.34
5.3.280.0070.02312.29
5.3.270.0090.03212.30
5.3.260.0120.02212.30
5.3.250.0130.03112.30
5.3.240.0050.02512.30
5.3.230.0070.02212.29
5.3.220.0060.02712.28
5.3.210.0120.03612.28
5.3.200.0130.03712.28
5.3.190.0050.03112.28
5.3.180.0080.03112.28
5.3.170.0070.02612.27
5.3.160.0080.02112.28
5.3.150.0040.02912.28
5.3.140.0090.02812.27
5.3.130.0090.02312.27
5.3.120.0080.02612.27
5.3.110.0060.02812.27
5.3.100.0060.02312.00
5.3.90.0070.02411.98
5.3.80.0070.02811.98
5.3.70.0040.03511.98
5.3.60.0080.02811.97
5.3.50.0070.02511.94
5.3.40.0100.02911.94
5.3.30.0080.02611.91
5.3.20.0080.02511.79
5.3.10.0050.03011.78
5.3.00.0070.03211.77
5.2.170.0080.0629.17
5.2.160.0040.0319.15
5.2.150.0070.0319.16
5.2.140.0080.0409.15
5.2.130.0070.0409.11
5.2.120.0050.0429.11
5.2.110.0090.0379.11
5.2.100.0060.0379.12
5.2.90.0040.0449.11
5.2.80.0100.0389.11
5.2.70.0070.0339.11
5.2.60.0080.0329.06
5.2.50.0070.0329.03
5.2.40.0080.0369.01
5.2.30.0050.0368.98
5.2.20.0100.0368.97
5.2.10.0080.0398.90
5.2.00.0130.0578.76
5.1.60.0100.0268.04
5.1.50.0050.0328.05
5.1.40.0070.0268.03
5.1.30.0050.0308.38
5.1.20.0070.0278.40
5.1.10.0080.0258.13
5.1.00.0080.0268.13
5.0.50.0030.0236.60
5.0.40.0040.0216.46
5.0.30.0050.0316.27
5.0.20.0050.0196.25
5.0.10.0080.0176.22
5.0.00.0030.0326.21
4.4.90.0040.0164.78
4.4.80.0040.0174.75
4.4.70.0070.0144.75
4.4.60.0040.0194.76
4.4.50.0070.0204.77
4.4.40.0070.0254.71
4.4.30.0050.0154.76
4.4.20.0060.0254.84
4.4.10.0050.0254.85
4.4.00.0060.0564.76
4.3.110.0060.0184.67
4.3.100.0050.0164.66
4.3.90.0060.0194.63
4.3.80.0050.0264.58
4.3.70.0060.0174.63
4.3.60.0050.0154.63
4.3.50.0040.0174.62
4.3.40.0040.0274.54
4.3.30.0170.0193.27
4.3.20.0040.0163.25
4.3.10.0030.0163.22
4.3.00.0000.02710.37

preferences:
45.78 ms | 400 KiB | 5 Q