3v4l.org

run code in 300+ PHP versions simultaneously
<?php $hotels = [ ['Tsambika', 2, 8.1, 9122], ['Tivoli', 2, 8.1, 11403], ['Sant-Amon', 1, 9.0, 14661], ['Radian', 2, 8.4, 17267], ['Filmar', 2, 8.4, 18510], ['Mon', 2, 8.7, 19222], ]; $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.0160.00016.88
8.3.50.0120.00921.13
8.3.40.0040.01118.83
8.3.30.0120.00319.30
8.3.20.0030.00520.29
8.3.10.0000.00823.74
8.3.00.0080.00019.50
8.2.180.0140.00318.16
8.2.170.0070.01122.96
8.2.160.0090.00620.22
8.2.150.0050.00324.18
8.2.140.0040.00424.66
8.2.130.0110.00426.16
8.2.120.0080.00022.38
8.2.110.0060.00319.33
8.2.100.0060.00617.78
8.2.90.0050.00319.32
8.2.80.0000.00917.97
8.2.70.0060.00317.75
8.2.60.0060.00317.93
8.2.50.0040.00418.07
8.2.40.0040.00418.28
8.2.30.0000.00818.35
8.2.20.0040.00417.95
8.2.10.0070.00018.27
8.2.00.0030.00717.77
8.1.280.0130.00625.92
8.1.270.0040.00423.96
8.1.260.0000.00826.35
8.1.250.0080.00028.09
8.1.240.0070.00322.13
8.1.230.0110.00021.02
8.1.220.0080.00018.70
8.1.210.0050.00318.77
8.1.200.0080.00617.50
8.1.190.0000.00817.35
8.1.180.0040.00418.10
8.1.170.0000.00818.70
8.1.160.0040.00422.16
8.1.150.0000.00818.64
8.1.140.0050.00317.46
8.1.130.0000.00817.95
8.1.120.0040.00417.53
8.1.110.0000.00817.59
8.1.100.0000.00817.59
8.1.90.0000.00817.62
8.1.80.0040.00417.45
8.1.70.0040.00417.48
8.1.60.0070.00017.64
8.1.50.0000.00917.61
8.1.40.0000.00917.66
8.1.30.0060.00317.66
8.1.20.0040.00417.67
8.1.10.0040.00417.70
8.1.00.0000.00817.46
8.0.300.0040.00418.77
8.0.290.0080.00017.00
8.0.280.0000.00718.56
8.0.270.0040.00417.36
8.0.260.0030.00317.29
8.0.250.0000.00617.04
8.0.240.0040.00417.05
8.0.230.0000.00717.02
8.0.220.0030.00317.00
8.0.210.0030.00316.98
8.0.200.0030.00317.08
8.0.190.0060.00317.08
8.0.180.0040.00416.97
8.0.170.0000.00917.04
8.0.160.0000.00716.92
8.0.150.0000.00716.95
8.0.140.0000.00716.86
8.0.130.0000.00613.49
8.0.120.0030.00517.02
8.0.110.0040.00416.89
8.0.100.0000.00817.09
8.0.90.0040.00416.86
8.0.80.0040.01517.00
8.0.70.0030.00616.98
8.0.60.0040.00416.85
8.0.50.0080.00016.96
8.0.30.0160.00217.41
8.0.20.0140.00717.40
8.0.10.0040.00416.94
8.0.00.0140.00917.03
7.4.330.0030.00315.03
7.4.320.0000.00716.59
7.4.300.0070.00016.62
7.4.290.0000.00716.51
7.4.280.0030.00516.60
7.4.270.0030.00316.68
7.4.260.0040.00416.69
7.4.250.0050.00216.64
7.4.240.0050.00216.65
7.4.230.0070.00016.64
7.4.220.0090.00916.80
7.4.210.0030.01116.64
7.4.200.0070.00016.64
7.4.190.0030.00316.78
7.4.160.0030.01216.40
7.4.150.0060.01217.40
7.4.140.0110.01117.86
7.4.130.0090.00916.63
7.4.120.0090.01116.64
7.4.110.0100.00716.74
7.4.100.0090.00916.61
7.4.90.0150.00316.69
7.4.80.0090.01519.39
7.4.70.0140.00716.75
7.4.60.0070.01016.70
7.4.50.0050.00316.57
7.4.40.0040.01522.77
7.4.30.0120.00616.59
7.4.10.0120.00615.20
7.4.00.0060.01114.99
7.3.330.0000.00513.48
7.3.320.0030.00313.22
7.3.310.0040.00416.51
7.3.300.0000.00716.46
7.3.290.0090.00616.46
7.3.280.0040.01416.47
7.3.270.0070.01417.40
7.3.260.0070.01116.52
7.3.250.0160.00516.56
7.3.240.0120.01216.51
7.3.230.0130.00716.62
7.3.210.0090.00916.66
7.3.200.0100.01319.39
7.3.190.0100.01316.72
7.3.180.0130.00316.75
7.3.170.0000.01516.54
7.3.160.0000.01616.65
7.3.130.0030.01314.77
7.3.120.0080.00914.79
7.3.110.0050.01014.93
7.3.100.0090.00515.08
7.3.90.0050.01114.94
7.3.80.0050.00714.80
7.3.70.0030.01014.86
7.3.60.0020.01314.98
7.3.50.0110.00414.99
7.3.40.0060.01014.84
7.3.30.0050.00814.96
7.3.20.0100.00516.69
7.3.10.0030.01016.56
7.3.00.0050.00916.45
7.2.330.0040.01516.89
7.2.320.0160.00316.72
7.2.310.0070.01116.76
7.2.300.0120.00916.67
7.2.290.0120.00616.86
7.2.260.0060.01315.02
7.2.250.0050.01115.01
7.2.240.0080.01014.94
7.2.230.0050.01015.04
7.2.220.0080.00615.21
7.2.210.0050.00915.11
7.2.200.0090.00415.23
7.2.190.0060.01114.92
7.2.180.0020.01515.13
7.2.170.0080.00815.10
7.2.160.0100.00615.14
7.2.150.0060.01317.12
7.2.140.0030.01317.03
7.2.130.0060.00816.97
7.2.120.0040.01216.98
7.2.110.0050.00616.88
7.2.100.0060.00816.92
7.2.90.0020.01016.87
7.2.80.0050.01017.07
7.2.70.0050.00716.99
7.2.60.0060.00616.94
7.2.50.0030.01116.97
7.2.40.0100.00317.05
7.2.30.0060.00517.02
7.2.20.0060.00616.81
7.2.10.0040.00817.03
7.2.00.0090.00417.73
7.1.330.0070.00715.88
7.1.320.0090.00915.91
7.1.310.0030.01215.92
7.1.300.0080.00815.68
7.1.290.0030.00815.77
7.1.280.0080.00715.81
7.1.270.0030.01015.89
7.1.260.0060.00715.84
7.1.250.0070.00515.73
7.1.240.0030.00715.87
7.1.230.0030.00915.60
7.1.220.0040.00815.71
7.1.210.0100.00615.74
7.1.200.0030.00915.76
7.1.190.0030.01015.81
7.1.180.0040.00715.77
7.1.170.0030.00615.59
7.1.160.0040.01115.80
7.1.150.0100.00015.65
7.1.140.0070.00315.70
7.1.130.0040.00715.93
7.1.120.0080.00815.79
7.1.110.0030.01315.64
7.1.100.0070.00617.00
7.1.90.0030.01315.89
7.1.80.0090.00615.89
7.1.70.0060.00516.34
7.1.60.0130.00717.68
7.1.50.0150.00725.42
7.1.40.0070.00315.58
7.1.30.0070.01015.92
7.1.20.0060.00615.75
7.1.10.0060.00315.85
7.1.00.0050.04219.13
7.0.330.0000.01315.18
7.0.320.0030.00915.35
7.0.310.0000.01015.61
7.0.300.0000.01315.11
7.0.290.0070.00415.61
7.0.280.0040.01115.36
7.0.270.0090.00015.54
7.0.260.0000.01415.53
7.0.250.0090.00615.62
7.0.240.0070.00715.59
7.0.230.0110.00315.58
7.0.220.0110.00315.39
7.0.210.0030.00615.64
7.0.200.0090.00415.11
7.0.190.0060.00615.55
7.0.180.0110.00315.53
7.0.170.0030.01015.23
7.0.160.0030.00915.22
7.0.150.0060.01015.51
7.0.140.0120.03318.75
7.0.130.0110.00415.46
7.0.120.0030.01015.39
7.0.110.0000.00915.50
7.0.100.0140.03817.84
7.0.90.0090.04617.67
7.0.80.0230.03617.74
7.0.70.0060.04417.66
7.0.60.0050.03917.69
7.0.50.0050.04417.95
7.0.40.0050.04516.77
7.0.30.0100.04216.77
7.0.20.0030.04716.82
7.0.10.0050.02716.83
7.0.00.0080.04516.76
5.6.400.0070.00714.43
5.6.390.0070.00714.00
5.6.380.0060.00914.71
5.6.370.0070.00714.55
5.6.360.0070.00714.67
5.6.350.0030.01214.39
5.6.340.0060.00614.32
5.6.330.0040.01114.27
5.6.320.0030.01414.77
5.6.310.0040.00714.77
5.6.300.0030.01014.55
5.6.290.0130.00014.52
5.6.280.0090.03617.83
5.6.270.0030.01014.63
5.6.260.0100.00614.39
5.6.250.0120.03817.41
5.6.240.0070.02717.57
5.6.230.0140.04017.54
5.6.220.0100.03917.57
5.6.210.0070.04217.48
5.6.200.0110.04217.90
5.6.190.0080.04317.79
5.6.180.0070.04517.88
5.6.170.0050.04517.75
5.6.160.0030.04317.66
5.6.150.0050.04317.75
5.6.140.0070.04417.67
5.6.130.0070.03517.72
5.6.120.0070.04717.86
5.6.110.0070.03017.73
5.6.100.0070.04017.68
5.6.90.0080.04317.77
5.6.80.0080.03717.32
5.6.70.0020.03517.61
5.6.60.0050.04017.46
5.6.50.0080.03317.63
5.6.40.0020.03117.47
5.6.30.0070.04517.38
5.6.20.0130.03817.41
5.6.10.0060.04517.39
5.6.00.0080.04117.44
5.5.380.0130.03917.55
5.5.370.0080.03217.36
5.5.360.0070.04517.37
5.5.350.0070.04517.46
5.5.340.0070.04517.60
5.5.330.0050.03717.83
5.5.320.0070.03517.77
5.5.310.0050.02917.69
5.5.300.0070.04417.71
5.5.290.0060.04617.70
5.5.280.0050.04317.60
5.5.270.0050.04817.63
5.5.260.0070.04117.74
5.5.250.0060.03017.38
5.5.240.0100.04317.32
5.5.230.0080.04217.27
5.5.220.0130.03717.44
5.5.210.0080.02517.45
5.5.200.0070.04617.34
5.5.190.0030.04417.24
5.5.180.0130.03717.33
5.5.170.0080.00514.48
5.5.160.0120.02317.39
5.5.150.0100.03817.22
5.5.140.0080.04217.29
5.5.130.0030.03817.35
5.5.120.0080.04217.34
5.5.110.0080.04317.49
5.5.100.0080.02517.37
5.5.90.0090.03817.24
5.5.80.0120.02217.33
5.5.70.0110.03617.22
5.5.60.0070.04217.21
5.5.50.0020.02717.30
5.5.40.0070.04017.13
5.5.30.0080.03817.34
5.5.20.0110.03917.31
5.5.10.0020.03017.09
5.5.00.0100.02517.04
5.4.450.0030.04215.52
5.4.440.0030.04515.51
5.4.430.0050.04215.46
5.4.420.0050.02915.51
5.4.410.0020.03215.45
5.4.400.0020.04815.37
5.4.390.0070.03915.26
5.4.380.0020.02715.27
5.4.370.0120.03815.35
5.4.360.0020.04515.30
5.4.350.0070.02015.36
5.4.340.0060.02015.36
5.4.330.0040.00711.60
5.4.320.0030.02915.27
5.4.310.0030.04315.39
5.4.300.0060.04015.39
5.4.290.0110.03615.35
5.4.280.0050.04315.41
5.4.270.0120.03515.36
5.4.260.0100.03515.35
5.4.250.0080.04015.25
5.4.240.0090.03015.33
5.4.230.0050.04915.39
5.4.220.0030.03715.25
5.4.210.0050.04015.35
5.4.200.0050.03215.35
5.4.190.0110.03515.26
5.4.180.0120.03715.41
5.4.170.0010.04315.35
5.4.160.0070.03015.27
5.4.150.0070.04015.29
5.4.140.0060.04014.06
5.4.130.0070.03513.93
5.4.120.0080.04013.95
5.4.110.0030.03714.06
5.4.100.0020.03714.07
5.4.90.0050.03614.10
5.4.80.0050.03813.98
5.4.70.0080.03813.99
5.4.60.0060.03814.04
5.4.50.0080.03514.00
5.4.40.0030.04514.05
5.4.30.0120.01814.00
5.4.20.0070.03714.01
5.4.10.0120.03514.03
5.4.00.0070.03013.74
5.3.290.0000.04413.13
5.3.280.0080.03713.10
5.3.270.0080.03813.10
5.3.260.0030.04113.03
5.3.250.0120.03213.03
5.3.240.0080.04113.08
5.3.230.0100.01813.08
5.3.220.0020.04113.04
5.3.210.0070.02713.04
5.3.200.0000.04313.08
5.3.190.0020.02713.01
5.3.180.0020.03912.99
5.3.170.0020.02913.08
5.3.160.0080.03513.08
5.3.150.0060.02413.01
5.3.140.0050.04213.04
5.3.130.0050.03613.01
5.3.120.0030.02613.05
5.3.110.0050.03913.03
5.3.100.0000.04712.80
5.3.90.0050.04012.74
5.3.80.0050.02812.76
5.3.70.0050.02512.78
5.3.60.0060.04012.69
5.3.50.0000.02912.66
5.3.40.0050.04412.76
5.3.30.0040.04012.71
5.3.20.0020.03812.65
5.3.10.0080.03412.63
5.3.00.0050.02712.51
5.2.170.0170.05311.18
5.2.160.0070.04311.05
5.2.150.0070.06010.96
5.2.140.0070.06311.12
5.2.130.0030.03711.09
5.2.120.0000.06710.92
5.2.110.0030.06711.11
5.2.100.0000.05710.96
5.2.90.0030.06311.07
5.2.80.0070.06011.09
5.2.70.0070.05711.16
5.2.60.0000.06710.93
5.2.50.0100.06011.09
5.2.40.0100.05711.04
5.2.30.0030.06010.97
5.2.20.0030.06310.81
5.2.10.0000.07010.77
5.2.00.0000.06310.66
5.1.60.0000.05310.00
5.1.50.0000.0479.82
5.1.40.0070.0509.98
5.1.30.0070.05310.37
5.1.20.0130.05010.21
5.1.10.0100.04710.06
5.1.00.0070.04010.06
5.0.50.0000.0508.61
5.0.40.0100.0178.41
5.0.30.0030.0608.23
5.0.20.0000.0478.23
5.0.10.0030.0408.27
5.0.00.0070.0578.14
4.4.90.0070.0338.06
4.4.80.0130.0338.06
4.4.70.0030.0378.06
4.4.60.0070.0308.06
4.4.50.0070.0338.06
4.4.40.0000.0278.06
4.4.30.0030.0278.06
4.4.20.0030.0378.06
4.4.10.0000.0278.06
4.4.00.0030.0578.06
4.3.110.0030.0378.06
4.3.100.0000.0308.06
4.3.90.0000.0378.06
4.3.80.0030.0508.06
4.3.70.0030.0238.06
4.3.60.0070.0278.06
4.3.50.0000.0408.06
4.3.40.0030.0478.06
4.3.30.0030.0338.06
4.3.20.0100.0278.06
4.3.10.0030.0338.06
4.3.00.0000.0378.06

preferences:
40.19 ms | 401 KiB | 5 Q