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', 4, 8.3, 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])*10; $priceToCompensate = $ratingDifference*$ratingCoef; echo $priceToCompensate."\r\n"; $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.0060.01218.43
8.3.50.0150.00721.15
8.3.40.0150.00618.71
8.3.30.0070.00718.85
8.3.20.0030.00618.65
8.3.10.0030.00520.60
8.3.00.0050.00323.69
8.2.180.0140.00716.50
8.2.170.0040.01222.96
8.2.160.0100.00321.99
8.2.150.0080.00024.18
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0040.00419.36
8.2.110.0090.00919.24
8.2.100.0110.00017.84
8.2.90.0000.00819.10
8.2.80.0030.00617.97
8.2.70.0100.00017.63
8.2.60.0040.00418.05
8.2.50.0000.00818.07
8.2.40.0040.00717.94
8.2.30.0030.00519.89
8.2.20.0080.00017.70
8.2.10.0040.00419.54
8.2.00.0070.00317.72
8.1.280.0040.01125.92
8.1.270.0000.00823.99
8.1.260.0100.01026.35
8.1.250.0080.00028.09
8.1.240.0040.00423.96
8.1.230.0040.00820.96
8.1.220.0050.00318.77
8.1.210.0000.00818.86
8.1.200.0100.00017.35
8.1.190.0040.00417.40
8.1.180.0040.00418.10
8.1.170.0030.00518.50
8.1.160.0040.00418.84
8.1.150.0000.00818.57
8.1.140.0000.00817.43
8.1.130.0000.00719.03
8.1.120.0000.00717.50
8.1.110.0000.00817.51
8.1.100.0000.00817.56
8.1.90.0040.00417.41
8.1.80.0030.00517.41
8.1.70.0000.00717.47
8.1.60.0030.00917.52
8.1.50.0060.00317.56
8.1.40.0040.00417.46
8.1.30.0040.00417.73
8.1.20.0030.00517.55
8.1.10.0060.00317.57
8.1.00.0040.00417.50
8.0.300.0050.00619.63
8.0.290.0040.00416.75
8.0.280.0030.00318.39
8.0.270.0000.00717.35
8.0.260.0070.00017.30
8.0.250.0040.00417.02
8.0.240.0090.00017.03
8.0.230.0030.00317.02
8.0.220.0030.00316.96
8.0.210.0040.00416.87
8.0.200.0060.00016.92
8.0.190.0040.00416.95
8.0.180.0040.00416.95
8.0.170.0040.00416.96
8.0.160.0000.00716.89
8.0.150.0040.00716.84
8.0.140.0020.00516.89
8.0.130.0040.00413.36
8.0.120.0040.00416.79
8.0.110.0000.00716.89
8.0.100.0040.00416.99
8.0.90.0040.00416.85
8.0.80.0090.00616.95
8.0.70.0030.00516.80
8.0.60.0070.00016.84
8.0.50.0040.00416.97
8.0.30.0120.00817.07
8.0.20.0090.00917.40
8.0.10.0040.00417.06
8.0.00.0140.00916.84
7.4.330.0030.00313.43
7.4.320.0030.00316.57
7.4.300.0030.00316.65
7.4.290.0000.00716.69
7.4.280.0030.00616.56
7.4.270.0090.00016.61
7.4.260.0030.00313.27
7.4.250.0040.00416.42
7.4.240.0040.00416.68
7.4.230.0040.00416.64
7.4.220.0080.00816.64
7.4.210.0070.01016.64
7.4.200.0000.00716.57
7.4.190.0040.00416.60
7.4.160.0030.01416.45
7.4.150.0060.01217.40
7.4.140.0060.01517.86
7.4.130.0130.00716.64
7.4.120.0100.01016.53
7.4.110.0040.01516.36
7.4.100.0070.01016.66
7.4.90.0080.01216.67
7.4.80.0100.00919.37
7.4.70.0130.01016.55
7.4.60.0030.01316.33
7.4.50.0000.00816.40
7.4.40.0030.01322.27
7.4.30.0160.01016.51
7.4.10.0110.00715.13
7.4.00.0090.00815.05
7.3.330.0020.00213.22
7.3.320.0050.00013.32
7.3.310.0040.00416.50
7.3.300.0030.00316.44
7.3.290.0050.01016.42
7.3.280.0070.00916.41
7.3.270.0170.00017.40
7.3.260.0070.01118.24
7.3.250.0070.01216.52
7.3.240.0070.01016.61
7.3.230.0040.01516.52
7.3.210.0070.01016.48
7.3.200.0060.01519.39
7.3.190.0160.00716.40
7.3.180.0060.01516.46
7.3.170.0030.01216.76
7.3.160.0100.00716.71
7.3.130.0090.00914.74
7.3.120.0070.01114.82
7.3.110.0050.01314.72
7.3.100.0050.01014.84
7.3.90.0040.01114.85
7.3.80.0050.00814.93
7.3.70.0030.01014.64
7.3.60.0020.01014.89
7.3.50.0080.00614.88
7.3.40.0060.00814.89
7.3.30.0060.00914.84
7.3.20.0090.00516.67
7.3.10.0050.00916.69
7.3.00.0070.00616.61
7.2.330.0120.00616.62
7.2.320.0060.01216.86
7.2.310.0090.00916.71
7.2.300.0130.00416.57
7.2.290.0090.00916.57
7.2.260.0100.01015.23
7.2.250.0060.01215.17
7.2.240.0020.01515.18
7.2.230.0050.01015.20
7.2.220.0050.00815.09
7.2.210.0100.00715.10
7.2.200.0070.00614.99
7.2.190.0050.00915.08
7.2.180.0060.00914.87
7.2.170.0050.00914.96
7.2.160.0100.01015.18
7.2.150.0070.00716.94
7.2.140.0060.00317.11
7.2.130.0060.00916.91
7.2.120.0090.00616.72
7.2.110.0000.01316.88
7.2.100.0070.00316.71
7.2.90.0100.00616.99
7.2.80.0030.00717.18
7.2.70.0030.01017.04
7.2.60.0030.01417.00
7.2.50.0130.00317.05
7.2.40.0080.00417.09
7.2.30.0000.00917.20
7.2.20.0120.00316.81
7.2.10.0030.00916.91
7.2.00.0120.00718.24
7.1.330.0070.00915.80
7.1.320.0060.00815.90
7.1.310.0050.01015.89
7.1.300.0060.00915.92
7.1.290.0050.00915.74
7.1.280.0100.00715.78
7.1.270.0040.00815.83
7.1.260.0040.00915.79
7.1.250.0040.00715.76
7.1.240.0040.00715.98
7.1.230.0100.00315.83
7.1.220.0030.00615.57
7.1.210.0060.00615.87
7.1.200.0000.01415.81
7.1.190.0070.00715.94
7.1.180.0090.00615.91
7.1.170.0120.00315.75
7.1.160.0070.00716.03
7.1.150.0030.00715.76
7.1.140.0100.00315.61
7.1.130.0040.00715.79
7.1.120.0080.00815.83
7.1.110.0040.01015.79
7.1.100.0050.00616.89
7.1.90.0080.00615.74
7.1.80.0070.01015.86
7.1.70.0050.00516.63
7.1.60.0110.00817.57
7.1.50.0060.01016.49
7.1.40.0040.01115.77
7.1.30.0100.00315.82
7.1.20.0070.00715.83
7.1.10.0040.00416.02
7.1.00.0090.02419.17
7.0.330.0060.00615.25
7.0.320.0090.00615.48
7.0.310.0060.00315.43
7.0.300.0070.00415.46
7.0.290.0070.00715.59
7.0.280.0060.00315.47
7.0.270.0050.00315.44
7.0.260.0090.00615.34
7.0.250.0030.00615.21
7.0.240.0000.01015.50
7.0.230.0100.00715.41
7.0.220.0100.01015.50
7.0.210.0060.00615.41
7.0.200.0030.00515.97
7.0.190.0000.00815.54
7.0.180.0040.00715.25
7.0.170.0070.00715.24
7.0.160.0030.00715.44
7.0.150.0070.00715.41
7.0.140.0080.03818.70
7.0.130.0030.01215.26
7.0.120.0100.00315.29
7.0.110.0070.00715.51
7.0.100.0000.01215.17
7.0.90.0060.00615.32
7.0.80.0120.00315.29
7.0.70.0050.03518.66
7.0.60.0050.04318.65
7.0.50.0020.04718.66
7.0.40.0030.04516.83
7.0.30.0060.03816.88
7.0.20.0050.04916.80
7.0.10.0020.04616.83
7.0.00.0070.04116.82
5.6.400.0030.01214.51
5.6.390.0060.00614.43
5.6.380.0130.00314.52
5.6.370.0030.01014.47
5.6.360.0030.00914.41
5.6.350.0110.00414.48
5.6.340.0000.01214.16
5.6.330.0000.00814.64
5.6.320.0000.01014.79
5.6.310.0080.01214.78
5.6.300.0040.00814.44
5.6.290.0090.00914.13
5.6.280.0030.04417.85
5.6.270.0040.00714.59
5.6.260.0030.00914.45
5.6.250.0030.00914.73
5.6.240.0040.01114.61
5.6.230.0100.00614.35
5.6.220.0030.03817.56
5.6.210.0100.03017.56
5.6.200.0070.04517.90
5.6.190.0050.04217.69
5.6.180.0070.04217.68
5.6.170.0100.02717.84
5.6.160.0040.02217.81
5.6.150.0020.04217.81
5.6.140.0050.04617.90
5.6.130.0020.04917.94
5.6.120.0110.03117.71
5.6.110.0050.03217.88
5.6.100.0060.02917.64
5.6.90.0070.04317.79
5.6.80.0060.04317.29
5.6.70.0020.03017.35
5.6.60.0030.04717.37
5.6.50.0050.04717.40
5.6.40.0050.04717.43
5.6.30.0070.03817.53
5.6.20.0050.03017.46
5.6.10.0050.02117.36
5.6.00.0080.03817.37
5.5.380.0030.01014.54
5.5.370.0000.01014.57
5.5.360.0080.03317.39
5.5.350.0100.04117.37
5.5.340.0080.04317.70
5.5.330.0100.04217.54
5.5.320.0030.05217.51
5.5.310.0060.04517.54
5.5.300.0050.04817.54
5.5.290.0030.03517.53
5.5.280.0100.04517.67
5.5.270.0060.04817.81
5.5.260.0110.02517.52
5.5.250.0060.04117.51
5.5.240.0090.03717.17
5.5.230.0090.04017.24
5.5.220.0050.04017.31
5.5.210.0030.03317.23
5.5.200.0140.02817.28
5.5.190.0000.02917.38
5.5.180.0030.04817.38
5.5.170.0090.00614.52
5.5.160.0040.02917.05
5.5.150.0030.02317.18
5.5.140.0020.02517.38
5.5.130.0020.02517.20
5.5.120.0040.02317.39
5.5.110.0040.02517.10
5.5.100.0030.03317.10
5.5.90.0070.01517.22
5.5.80.0030.01817.17
5.5.70.0060.02117.18
5.5.60.0060.03817.32
5.5.50.0030.01817.22
5.5.40.0020.02317.02
5.5.30.0030.03117.08
5.5.20.0070.01916.95
5.5.10.0030.04417.16
5.5.00.0070.02517.22
5.4.450.0050.03015.41
5.4.440.0050.04115.13
5.4.430.0040.04215.46
5.4.420.0030.04515.32
5.4.410.0030.04415.18
5.4.400.0030.03014.97
5.4.390.0080.04015.04
5.4.380.0030.04415.02
5.4.370.0020.04614.93
5.4.360.0020.04215.14
5.4.350.0020.04115.13
5.4.340.0050.02515.06
5.4.330.0030.00710.77
5.4.320.0020.03815.17
5.4.310.0020.02215.12
5.4.300.0020.02415.10
5.4.290.0070.01814.87
5.4.280.0020.02215.08
5.4.270.0070.01715.14
5.4.260.0010.02515.01
5.4.250.0080.01615.08
5.4.240.0040.01915.20
5.4.230.0030.02114.98
5.4.220.0030.01815.13
5.4.210.0030.01615.21
5.4.200.0030.01915.04
5.4.190.0090.01515.13
5.4.180.0020.04315.18
5.4.170.0020.02015.09
5.4.160.0060.03815.03
5.4.150.0050.02014.96
5.4.140.0050.02313.69
5.4.130.0060.01913.86
5.4.120.0020.02013.67
5.4.110.0020.02513.74
5.4.100.0050.02013.78
5.4.90.0050.01613.63
5.4.80.0020.01913.61
5.4.70.0020.02213.78
5.4.60.0040.01813.62
5.4.50.0050.01813.71
5.4.40.0000.02213.71
5.4.30.0040.01813.74
5.4.20.0060.01613.76
5.4.10.0000.01813.86
5.4.00.0050.01613.53
5.3.290.0020.02512.61
5.3.280.0080.01512.53
5.3.270.0060.01512.58
5.3.260.0050.02012.56
5.3.250.0010.02612.54
5.3.240.0050.02412.57
5.3.230.0000.02012.60
5.3.220.0020.01912.59
5.3.210.0020.03012.53
5.3.200.0030.02212.58
5.3.190.0020.02212.57
5.3.180.0040.01312.50
5.3.170.0030.02012.57
5.3.160.0030.01812.59
5.3.150.0030.02012.58
5.3.140.0020.01912.55
5.3.130.0040.01512.55
5.3.120.0020.02012.55
5.3.110.0030.01812.49
5.3.100.0000.02012.23
5.3.90.0020.01812.29
5.3.80.0030.01812.24
5.3.70.0030.01612.29
5.3.60.0020.01912.27
5.3.50.0020.01812.27
5.3.40.0030.01612.25
5.3.30.0000.02112.19
5.3.20.0030.01512.14
5.3.10.0040.01712.12
5.3.00.0020.01812.00
5.2.170.0000.02311.45
5.2.160.0000.02311.45
5.2.150.0000.02311.45
5.2.140.0000.02311.45
5.2.130.0000.02311.45
5.2.120.0030.02011.45
5.2.110.0030.02311.45
5.2.100.0030.02311.45
5.2.90.0000.02311.45
5.2.80.0030.02711.45
5.2.70.0030.03011.45
5.2.60.0000.03311.45
5.2.50.0000.02311.45
5.2.40.0000.02311.45
5.2.30.0000.02311.45
5.2.20.0000.03711.45
5.2.10.0000.04711.45
5.2.00.0000.06011.45
5.1.60.0000.04011.45
5.1.50.0000.03711.45
5.1.40.0070.04011.45
5.1.30.0000.05311.45
5.1.20.0030.05011.45
5.1.10.0000.05011.45
5.1.00.0000.05711.45
5.0.50.0000.03711.45
5.0.40.0030.04011.45
5.0.30.0070.06311.45
5.0.20.0030.04311.45
5.0.10.0030.04311.45
5.0.00.0030.06711.45
4.4.90.0000.01311.45
4.4.80.0000.01311.45
4.4.70.0000.03311.45
4.4.60.0030.02711.45
4.4.50.0000.03711.45
4.4.40.0030.03711.45
4.4.30.0000.03011.45
4.4.20.0030.03311.45
4.4.10.0070.02711.45
4.4.00.0030.05311.45
4.3.110.0000.03711.45
4.3.100.0000.03011.45
4.3.90.0000.02711.45
4.3.80.0000.04711.45
4.3.70.0000.02311.45
4.3.60.0000.02311.45
4.3.50.0030.03311.45
4.3.40.0030.05011.45
4.3.30.0070.03011.45
4.3.20.0000.03311.45
4.3.10.0070.02711.45
4.3.00.0000.03311.45

preferences:
41.98 ms | 400 KiB | 5 Q