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][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 $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.0040.01118.29
8.3.50.0110.01017.46
8.3.40.0110.01118.93
8.3.30.0090.00618.77
8.3.20.0190.00018.73
8.3.10.0130.00620.61
8.3.00.0040.01517.63
8.2.180.0090.00916.50
8.2.170.0070.01122.96
8.2.160.0100.01022.12
8.2.150.0040.00424.18
8.2.140.0050.00324.66
8.2.130.0040.00426.16
8.2.120.0060.00320.02
8.2.110.0060.00320.96
8.2.100.0110.00017.91
8.2.90.0050.00519.39
8.2.80.0000.00818.04
8.2.70.0080.00017.63
8.2.60.0000.00918.03
8.2.50.0080.00018.07
8.2.40.0000.00920.00
8.2.30.0000.01018.04
8.2.20.0000.00717.70
8.2.10.0060.00317.93
8.2.00.0130.00317.95
8.1.280.0030.01725.92
8.1.270.0000.00824.66
8.1.260.0000.00826.35
8.1.250.0000.00728.09
8.1.240.0070.00320.70
8.1.230.0070.00420.89
8.1.220.0060.00317.74
8.1.210.0030.00518.80
8.1.200.0030.00617.35
8.1.190.0040.00417.63
8.1.180.0000.00818.10
8.1.170.0040.00418.82
8.1.160.0030.00518.84
8.1.150.0050.00318.67
8.1.140.0060.00317.53
8.1.130.0030.00517.86
8.1.120.0070.00017.38
8.1.110.0040.00417.37
8.1.100.0050.00317.37
8.1.90.0080.00017.35
8.1.80.0080.00017.39
8.1.70.0000.00717.37
8.1.60.0040.00417.62
8.1.50.0000.00717.49
8.1.40.0000.00817.53
8.1.30.0000.00817.57
8.1.20.0060.00317.67
8.1.10.0040.00417.62
8.1.00.0000.00917.58
8.0.300.0020.00520.01
8.0.290.0000.00716.88
8.0.280.0000.00818.52
8.0.270.0000.00717.36
8.0.260.0070.00016.86
8.0.250.0040.00417.08
8.0.240.0070.00517.06
8.0.230.0040.00417.05
8.0.220.0070.00017.04
8.0.210.0090.00016.91
8.0.200.0030.00317.07
8.0.190.0040.00417.05
8.0.180.0050.00216.93
8.0.170.0060.00316.89
8.0.160.0040.00416.93
8.0.150.0030.00616.82
8.0.140.0000.00816.88
8.0.130.0000.00813.45
8.0.120.0040.00416.84
8.0.110.0030.00616.95
8.0.100.0030.00616.81
8.0.90.0020.00516.88
8.0.80.0070.01016.99
8.0.70.0040.00416.87
8.0.60.0020.00516.96
8.0.50.0040.00416.99
8.0.30.0100.01017.31
8.0.20.0110.00816.94
8.0.10.0000.00717.12
8.0.00.0100.01016.77
7.4.330.0050.00013.02
7.4.320.0030.00316.54
7.4.300.0030.00316.61
7.4.290.0070.00016.65
7.4.280.0000.01116.60
7.4.270.0060.00316.62
7.4.260.0050.00013.37
7.4.250.0050.00316.66
7.4.240.0070.00016.54
7.4.230.0040.00416.34
7.4.220.0100.01016.52
7.4.210.0070.01116.56
7.4.200.0050.00316.36
7.4.190.0000.00716.73
7.4.160.0180.00416.48
7.4.150.0170.00616.68
7.4.140.0060.01416.61
7.4.130.0130.00816.49
7.4.120.0070.01316.54
7.4.110.0070.01116.50
7.4.100.0070.01016.45
7.4.90.0170.00316.66
7.4.80.0120.00616.50
7.4.70.0100.01416.43
7.4.60.0130.00316.73
7.4.50.0040.00416.64
7.4.40.0090.00316.65
7.4.30.0100.00716.78
7.4.00.0070.01014.80
7.3.330.0000.00613.29
7.3.320.0050.00013.34
7.3.310.0000.00816.57
7.3.300.0030.00316.51
7.3.290.0050.01616.43
7.3.280.0120.00416.45
7.3.270.0110.00816.68
7.3.260.0100.00916.62
7.3.250.0150.00916.62
7.3.240.0130.00316.62
7.3.230.0150.00416.35
7.3.210.0110.00616.40
7.3.200.0140.01019.39
7.3.190.0130.00916.51
7.3.180.0130.00316.59
7.3.170.0140.00316.66
7.3.160.0140.00416.47
7.3.120.0050.01214.86
7.3.110.0060.01315.03
7.3.100.0030.01414.75
7.3.90.0110.00615.05
7.3.80.0090.00614.99
7.3.70.0040.01114.94
7.3.60.0090.00614.93
7.3.50.0060.00615.07
7.3.40.0070.01014.73
7.3.30.0030.00715.02
7.3.20.0030.00616.84
7.3.10.0030.01316.64
7.3.00.0070.00716.60
7.2.330.0190.00016.60
7.2.320.0060.01216.56
7.2.310.0130.01216.61
7.2.300.0110.00716.66
7.2.290.0100.00816.86
7.2.250.0030.01515.24
7.2.240.0140.00715.27
7.2.230.0070.01015.09
7.2.220.0060.01015.28
7.2.210.0060.01315.01
7.2.200.0090.00915.13
7.2.190.0110.00415.25
7.2.180.0030.01014.93
7.2.170.0070.00315.10
7.2.130.0100.00316.83
7.2.120.0000.01516.87
7.2.110.0030.00917.09
7.2.100.0060.00617.00
7.2.90.0040.01116.99
7.2.80.0040.01116.85
7.2.70.0000.01516.89
7.2.60.0030.01316.93
7.2.50.0040.01116.94
7.2.40.0120.00316.92
7.2.30.0070.01117.03
7.2.20.0120.00017.01
7.2.10.0060.00817.06
7.2.00.0050.01018.28
7.1.330.0030.00615.81
7.1.320.0030.01015.85
7.1.310.0030.01415.57
7.1.300.0030.01215.64
7.1.290.0040.00816.00
7.1.280.0060.00315.85
7.1.270.0040.01115.96
7.1.260.0060.00915.79
7.1.250.0000.01415.82
7.1.240.0030.01015.98
7.1.230.0030.01015.96
7.1.220.0070.00315.58
7.1.210.0030.00615.80
7.1.200.0030.01015.66
7.1.190.0070.00715.64
7.1.180.0060.00315.71
7.1.170.0070.00715.65
7.1.160.0030.00915.77
7.1.150.0070.00715.82
7.1.140.0000.01315.84
7.1.130.0040.00815.83
7.1.120.0030.01315.43
7.1.110.0110.00415.88
7.1.100.0110.00216.96
7.1.90.0070.00416.02
7.1.80.0100.00316.03
7.1.70.0040.00816.36
7.1.60.0080.01217.63
7.1.50.0080.01016.54
7.1.40.0100.00315.82
7.1.30.0000.01115.93
7.1.20.0030.01415.72
7.1.10.0110.00615.87
7.1.00.0050.04219.22
7.0.330.0100.00415.38
7.0.320.0090.00015.36
7.0.310.0060.00615.38
7.0.300.0000.01515.03
7.0.290.0070.00715.34
7.0.280.0000.01315.42
7.0.270.0060.00915.36
7.0.260.0030.00615.35
7.0.250.0070.00715.19
7.0.240.0070.00715.44
7.0.230.0060.00315.55
7.0.220.0100.00315.42
7.0.210.0070.00715.32
7.0.200.0050.00716.20
7.0.190.0130.00015.59
7.0.180.0060.00915.24
7.0.170.0090.00615.16
7.0.160.0070.00715.43
7.0.150.0040.00715.22
7.0.140.0030.03818.77
7.0.130.0030.00815.37
7.0.120.0030.03718.72
7.0.110.0040.00715.26
7.0.100.0000.01215.34
7.0.90.0040.00815.41
7.0.80.0040.00415.54
7.0.70.0050.01818.49
7.0.60.0050.02018.54
7.0.50.0020.02218.83
7.0.40.0020.02216.70
7.0.30.0050.02916.80
7.0.20.0040.02016.61
7.0.10.0070.01516.74
7.0.00.0020.02916.75
5.6.380.0090.00014.47
5.6.370.0000.01514.70
5.6.360.0070.00314.45
5.6.350.0090.00314.07
5.6.340.0030.01414.51
5.6.330.0090.00014.05
5.6.320.0060.01014.54
5.6.310.0030.01014.65
5.6.300.0040.01214.14
5.6.290.0030.00914.48
5.6.280.0070.03917.53
5.6.270.0100.00314.33
5.6.260.0030.00614.08
5.6.250.0000.01314.45
5.6.240.0130.00014.33
5.6.230.0090.00614.37
5.6.220.0030.02217.59
5.6.210.0070.01817.47
5.6.200.0030.02217.71
5.6.190.0020.02517.73
5.6.180.0030.01917.89
5.6.170.0020.02517.61
5.6.160.0070.01917.61
5.6.150.0050.02517.63
5.6.140.0020.02717.54
5.6.130.0060.01817.75
5.6.120.0080.03817.78
5.6.110.0050.04517.50
5.6.100.0050.03117.63
5.6.90.0030.04617.68
5.6.80.0040.04217.32
5.6.70.0030.04217.28
5.6.60.0100.04117.29
5.6.50.0050.04517.38
5.6.40.0070.03917.20
5.6.30.0020.04217.55
5.6.20.0080.04017.45
5.6.10.0000.04517.45
5.6.00.0080.03517.27
5.5.380.0050.00311.18
5.5.370.0030.00711.30
5.5.360.0030.01715.84
5.5.350.0030.02015.84
5.5.340.0040.02016.02
5.5.330.0020.01916.05
5.5.320.0020.02516.23
5.5.310.0020.02516.07
5.5.300.0000.02916.03
5.5.290.0040.04516.04
5.5.280.0020.04616.11
5.5.270.0050.03816.03
5.5.260.0020.03416.01
5.5.250.0020.04215.87
5.5.240.0100.02715.72
5.5.230.0070.03415.76
5.5.220.0050.04115.65
5.5.210.0050.04015.71
5.5.200.0100.03715.65
5.5.190.0020.04315.76
5.5.180.0070.04015.63
5.5.170.0000.01311.18
5.5.160.0050.04515.69
5.5.150.0100.03815.91
5.5.140.0050.04115.63
5.5.130.0050.02515.72
5.5.120.0000.04315.70
5.5.110.0080.03115.67
5.5.100.0070.03215.72
5.5.90.0080.03415.70
5.5.80.0030.03415.67
5.5.70.0040.03615.67
5.5.60.0050.03015.64
5.5.50.0030.02315.64
5.5.40.0080.03115.62
5.5.30.0060.02815.66
5.5.20.0050.04315.65
5.5.10.0050.03815.62
5.5.00.0100.03215.61
5.4.450.0030.04515.49
5.4.440.0080.03515.33
5.4.430.0010.04815.46
5.4.420.0070.04215.43
5.4.410.0060.04115.29
5.4.400.0030.03715.16
5.4.390.0050.02315.20
5.4.380.0080.03715.11
5.4.370.0050.03015.05
5.4.360.0060.03615.15
5.4.350.0030.04215.20
5.4.340.0080.03615.07
5.4.330.0050.00211.18
5.4.320.0050.04315.19
5.4.310.0030.04115.19
5.4.300.0050.04015.16
5.4.290.0030.04315.09
5.4.280.0020.04215.20
5.4.270.0050.03515.21
5.4.260.0050.04015.06
5.4.250.0070.03915.19
5.4.240.0020.03915.04
5.4.230.0030.03015.10
5.4.220.0030.02715.13
5.4.210.0030.02415.08
5.4.200.0030.02115.14
5.4.190.0020.02515.16
5.4.180.0050.03115.13
5.4.170.0070.03815.14
5.4.160.0060.03615.19
5.4.150.0050.02815.18
5.4.140.0070.04013.76
5.4.130.0030.03513.81
5.4.120.0030.03813.84
5.4.110.0050.03313.78
5.4.100.0050.02113.99
5.4.90.0040.02613.78
5.4.80.0060.03713.83
5.4.70.0050.03913.77
5.4.60.0050.03813.78
5.4.50.0080.02113.82
5.4.40.0050.03813.79
5.4.30.0040.03013.76
5.4.20.0040.03413.83
5.4.10.0030.03913.76
5.4.00.0050.03313.50
5.3.290.0050.04012.92
5.3.280.0030.03812.79
5.3.270.0060.03512.89
5.3.260.0030.04112.84
5.3.250.0000.04312.87
5.3.240.0080.03612.82
5.3.230.0040.03412.86
5.3.220.0050.03712.79
5.3.210.0000.03712.84
5.3.200.0000.03112.85
5.3.190.0020.02712.87
5.3.180.0060.03712.86
5.3.170.0050.02312.79
5.3.160.0080.01812.84
5.3.150.0100.01512.85
5.3.140.0040.03812.86
5.3.130.0020.04012.79
5.3.120.0030.04312.84
5.3.110.0050.03812.85
5.3.100.0100.03212.61
5.3.90.0020.04112.57
5.3.80.0050.03712.60
5.3.70.0030.03612.52
5.3.60.0070.02712.59
5.3.50.0050.03712.51
5.3.40.0030.03712.51
5.3.30.0070.02312.53
5.3.20.0000.04212.38
5.3.10.0020.02912.38
5.3.00.0050.03912.33
5.2.170.0060.02011.14
5.2.160.0030.03511.18
5.2.150.0060.01711.14
5.2.140.0000.03811.19
5.2.130.0050.03011.17
5.2.120.0030.03011.14
5.2.110.0050.02811.14
5.2.100.0000.03411.14
5.2.90.0010.02111.14
5.2.80.0060.02411.16
5.2.70.0030.03511.15
5.2.60.0060.02811.14
5.2.50.0060.03211.14
5.2.40.0020.02611.14
5.2.30.0030.02911.14
5.2.20.0040.02911.14
5.2.10.0030.03011.14
5.2.00.0030.03411.14
5.1.60.0050.02511.14
5.1.50.0030.02811.14
5.1.40.0000.03111.14
5.1.30.0030.02211.14
5.1.20.0030.02211.14
5.1.10.0050.02511.14
5.1.00.0020.02811.14
5.0.50.0060.02311.14
5.0.40.0030.02311.14
5.0.30.0020.02211.14
5.0.20.0070.02011.14
5.0.10.0000.02811.14
5.0.00.0040.03511.14
4.4.90.0030.01811.14
4.4.80.0040.01711.14
4.4.70.0020.01811.14
4.4.60.0020.02011.14
4.4.50.0000.01911.14
4.4.40.0030.02511.14
4.4.30.0000.01711.14
4.4.20.0010.02111.14
4.4.10.0020.01711.14
4.4.00.0050.02711.14
4.3.110.0010.01611.14
4.3.100.0000.01411.14
4.3.90.0000.01511.14
4.3.80.0050.02511.14
4.3.70.0000.01811.14
4.3.60.0030.01111.14
4.3.50.0030.01211.14
4.3.40.0000.02311.14
4.3.30.0000.02111.14
4.3.20.0010.02011.14
4.3.10.0010.01511.14
4.3.00.0030.01411.14

preferences:
43.79 ms | 401 KiB | 5 Q