3v4l.org

run code in 300+ PHP versions simultaneously
<?php $hotels = [ ['Mar', 4, 8.0, 38770], ['Vilamar', 4, 8.0, 45400], ['Enidor', 4, 8.0, 48060], ['Vinsdor', 3, 8.2, 50210], ['Palace', 4, 8.1, 52343], ['Mirasol', 4, 8.1, 52480], ['Blisa', 5, 8.3, 54280], ]; $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.0090.00616.63
8.3.50.0070.01417.96
8.3.40.0040.01118.92
8.3.30.0000.01419.21
8.3.20.0000.00820.29
8.3.10.0080.00023.52
8.3.00.0080.00019.63
8.2.180.0070.01118.38
8.2.170.0150.00022.96
8.2.160.0110.01120.52
8.2.150.0050.00324.18
8.2.140.0050.00324.66
8.2.130.0030.00626.16
8.2.120.0000.00722.23
8.2.110.0070.00322.20
8.2.100.0090.00317.91
8.2.90.0040.00418.01
8.2.80.0040.00417.97
8.2.70.0000.00817.61
8.2.60.0000.00817.93
8.2.50.0000.00918.07
8.2.40.0010.00718.34
8.2.30.0050.00218.11
8.2.20.0040.00417.87
8.2.10.0030.00618.33
8.2.00.0000.00917.94
8.1.270.0080.00023.96
8.1.260.0040.00426.35
8.1.250.0000.00828.09
8.1.240.0090.00022.73
8.1.230.0060.00621.03
8.1.220.0030.00517.89
8.1.210.0030.00519.04
8.1.200.0100.00017.48
8.1.190.0000.00817.36
8.1.180.0030.00518.10
8.1.170.0030.00618.71
8.1.160.0040.00422.04
8.1.150.0030.00518.75
8.1.140.0000.00717.55
8.1.130.0070.00017.84
8.1.120.0000.00817.67
8.1.110.0050.00217.46
8.1.100.0050.00317.57
8.1.90.0050.00217.46
8.1.80.0070.00017.50
8.1.70.0000.00717.42
8.1.60.0050.00317.71
8.1.50.0080.00017.67
8.1.40.0050.00317.69
8.1.30.0040.00417.71
8.1.20.0050.00317.59
8.1.10.0060.00317.69
8.1.00.0040.00417.51
8.0.300.0060.00320.15
8.0.290.0000.00716.88
8.0.280.0000.00818.47
8.0.270.0000.00717.37
8.0.260.0070.00017.41
8.0.250.0000.00817.05
8.0.240.0000.00717.14
8.0.230.0000.00717.03
8.0.220.0030.00316.88
8.0.210.0030.00616.98
8.0.200.0030.00316.99
8.0.190.0000.00817.07
8.0.180.0050.00317.05
8.0.170.0030.00617.05
8.0.160.0040.00417.05
8.0.150.0040.00416.95
8.0.140.0050.00316.89
8.0.130.0030.00313.36
8.0.120.0040.00416.86
8.0.110.0000.00716.90
8.0.100.0000.00816.89
8.0.90.0070.00016.89
8.0.80.0060.01316.93
8.0.70.0070.00016.99
8.0.60.0040.00416.99
8.0.50.0040.00416.80
8.0.30.0100.01017.20
8.0.20.0030.01517.40
8.0.10.0000.00816.93
8.0.00.0100.01016.88
7.4.330.0040.00415.00
7.4.320.0070.00016.53
7.4.300.0000.00616.46
7.4.290.0070.00016.62
7.4.280.0000.00716.46
7.4.270.0080.00016.72
7.4.260.0050.00316.66
7.4.250.0000.00816.71
7.4.240.0050.00216.71
7.4.230.0000.00716.77
7.4.220.0060.01216.57
7.4.210.0070.01116.73
7.4.200.0040.00416.73
7.4.190.0000.00816.67
7.4.160.0130.00316.59
7.4.150.0140.00317.40
7.4.140.0060.01417.86
7.4.130.0130.00516.63
7.4.120.0120.00816.61
7.4.110.0090.00916.48
7.4.100.0030.02316.71
7.4.90.0040.01316.65
7.4.80.0140.00519.39
7.4.70.0000.01616.52
7.4.60.0080.00816.57
7.4.50.0000.00816.32
7.4.40.0000.01922.77
7.4.30.0040.01216.66
7.4.00.0050.00914.94
7.3.330.0050.00313.25
7.3.320.0020.00213.45
7.3.310.0030.00516.29
7.3.300.0030.00316.47
7.3.290.0040.01016.51
7.3.280.0070.01016.43
7.3.270.0160.00317.40
7.3.260.0120.00616.52
7.3.250.0090.00916.56
7.3.240.0140.00916.50
7.3.230.0110.01416.39
7.3.210.0080.01216.58
7.3.200.0120.00619.39
7.3.190.0000.01916.64
7.3.180.0090.01016.59
7.3.170.0090.00616.84
7.3.160.0090.00916.66
7.3.120.0080.00815.07
7.3.110.0030.01414.96
7.3.100.0080.00614.98
7.3.90.0090.00614.92
7.3.80.0030.00914.83
7.3.70.0030.01014.66
7.3.60.0060.00914.76
7.3.50.0080.00714.77
7.3.40.0080.00814.78
7.3.30.0060.00714.93
7.3.20.0080.00616.83
7.3.10.0090.00416.59
7.3.00.0030.01216.70
7.2.330.0060.01316.95
7.2.320.0120.00916.88
7.2.310.0090.00916.54
7.2.300.0070.01016.67
7.2.290.0090.00916.95
7.2.250.0000.01614.99
7.2.240.0080.00915.19
7.2.230.0060.00715.03
7.2.220.0080.00715.21
7.2.210.0110.00315.31
7.2.200.0080.00514.93
7.2.190.0060.00915.25
7.2.180.0060.00715.17
7.2.170.0030.01015.17
7.2.160.0060.00915.22
7.2.150.0040.01117.02
7.2.140.0000.01716.58
7.2.130.0100.00616.85
7.2.120.0100.00317.02
7.2.110.0060.01216.93
7.2.100.0100.00617.02
7.2.90.0070.01017.05
7.2.80.0030.01216.89
7.2.70.0030.01516.93
7.2.60.0080.00416.98
7.2.50.0030.01316.69
7.2.40.0070.00716.86
7.2.30.0000.01516.64
7.2.20.0040.00817.05
7.2.10.0070.01017.04
7.2.00.0040.01116.83
7.1.330.0070.00915.75
7.1.320.0110.00315.93
7.1.310.0080.00515.87
7.1.300.0050.00715.81
7.1.290.0050.01015.81
7.1.280.0110.00215.77
7.1.270.0060.00915.90
7.1.260.0100.00515.67
7.1.250.0000.01715.84
7.1.100.0030.01018.05
7.1.70.0000.00817.10
7.1.60.0040.01119.33
7.1.50.0160.00317.11
7.1.00.0070.07322.44
7.0.200.0060.00316.88
7.0.140.0030.07322.12
7.0.60.0070.03720.00
7.0.50.0030.06717.91
7.0.40.0100.08319.96
7.0.30.0430.05020.23
7.0.20.0170.08320.10
7.0.10.0070.08720.23
7.0.00.0030.09320.06
5.6.280.0070.07020.84
5.6.210.0070.08720.70
5.6.200.0030.05318.17
5.6.190.0070.04320.58
5.6.180.0230.08020.52
5.6.170.0370.07020.44
5.6.160.0100.08720.58
5.6.150.0000.07018.14
5.6.140.0070.03718.21
5.6.130.0070.05318.19
5.6.120.0200.06721.14
5.6.110.0030.04321.04
5.6.100.0100.04721.15
5.6.90.0130.04721.14
5.6.80.0030.04720.42
5.6.70.0170.06320.29
5.5.350.0100.07720.43
5.5.340.0070.07317.96
5.5.330.0030.05020.57
5.5.320.0400.07020.44
5.5.310.0330.08020.25
5.5.300.0000.06718.01
5.5.290.0070.08317.93
5.5.280.0070.08320.68
5.5.270.0070.05020.68
5.5.260.0070.03720.85
5.5.250.0070.04020.79
5.5.240.0130.05020.14
5.4.450.0170.05319.17
5.4.440.0270.06719.61
5.4.430.0130.06019.45
5.4.420.0630.00019.68
5.4.410.0070.06019.11
5.4.400.0230.05018.76
5.4.390.0230.05718.71
5.4.380.0100.05718.76
5.4.370.0030.05718.77
5.4.360.0130.03718.77
5.4.350.0100.04012.04
5.4.340.0060.03712.04
5.4.320.0090.03412.53
5.4.310.0080.04412.53
5.4.300.0050.04312.53
5.4.290.0050.03912.53
5.4.280.0110.03712.40
5.4.270.0070.04112.40
5.4.260.0090.06112.39
5.4.250.0150.08312.40
5.4.240.0140.04812.39
5.4.230.0150.04912.39
5.4.220.0180.03812.39
5.4.210.0110.03412.39
5.4.200.0050.04212.39
5.4.190.0050.04312.39
5.4.180.0090.03812.39
5.4.170.0070.04012.39
5.4.160.0100.03812.39
5.4.150.0160.08012.39
5.4.140.0090.04112.07
5.4.130.0080.04812.06
5.4.120.0060.05112.02
5.4.110.0120.04512.02
5.4.100.0110.04912.02
5.4.90.0140.04912.02
5.4.80.0100.05112.02
5.4.70.0100.06112.01
5.4.60.0140.05412.01
5.4.50.0070.04312.01
5.4.40.0130.05212.00
5.4.30.0150.05612.00
5.4.20.0120.04012.00
5.4.10.0080.04712.00
5.4.00.0030.04111.49
5.3.290.0040.04412.80
5.3.280.0080.04712.71
5.3.270.0140.03812.72
5.3.260.0080.04712.72
5.3.250.0070.05212.72
5.3.240.0090.04512.72
5.3.230.0070.05112.71
5.3.220.0080.04112.68
5.3.210.0110.06212.68
5.3.200.0090.06012.68
5.3.190.0080.06212.68
5.3.180.0070.06112.67
5.3.170.0090.05812.67
5.3.160.0200.06412.67
5.3.150.0100.05412.67
5.3.140.0060.05412.66
5.3.130.0090.04412.66
5.3.120.0170.07012.66
5.3.110.0050.06612.66
5.3.100.0090.06012.12
5.3.90.0140.06012.09
5.3.80.0110.05212.07
5.3.70.0120.04512.08
5.3.60.0170.05812.07
5.3.50.0150.04812.00
5.3.40.0160.06412.00
5.3.30.0090.05611.94
5.3.20.0120.04711.70
5.3.10.0190.05711.67
5.3.00.0070.05611.66
5.2.170.0090.0449.15
5.2.160.0100.0379.15
5.2.150.0080.0329.15
5.2.140.0080.0309.14
5.2.130.0040.0329.11
5.2.120.0040.0329.11
5.2.110.0050.0309.12
5.2.100.0050.0319.12
5.2.90.0050.0359.11
5.2.80.0070.0359.11
5.2.70.0070.0309.11
5.2.60.0110.0399.05
5.2.50.0060.0439.04
5.2.40.0260.0589.00
5.2.30.0060.0358.98
5.2.20.0120.0558.97
5.2.10.0070.0368.90
5.2.00.0060.0298.76
5.1.60.0090.0438.05
5.1.50.0070.0268.05
5.1.40.0090.0338.03
5.1.30.0110.0438.38
5.1.20.0090.0478.39
5.1.10.0060.0538.13
5.1.00.0070.0468.13
5.0.50.0080.0416.60
5.0.40.0060.0446.46
5.0.30.0060.0436.27
5.0.20.0080.0246.24
5.0.10.0060.0206.22
5.0.00.0090.0396.21
4.4.90.0120.0364.78
4.4.80.0030.0174.75
4.4.70.0020.0184.76
4.4.60.0070.0154.75
4.4.50.0040.0194.77
4.4.40.0140.0624.71
4.4.30.0030.0254.76
4.4.20.0060.0234.84
4.4.10.0070.0274.85
4.4.00.0050.0254.76
4.3.110.0030.0264.67
4.3.100.0030.0284.66
4.3.90.0040.0384.64
4.3.80.0060.0344.59
4.3.70.0050.0264.63
4.3.60.0030.0204.63
4.3.50.0040.0164.63
4.3.40.0050.0444.54
4.3.30.0080.0223.27
4.3.20.0030.0273.25
4.3.10.0130.0273.22
4.3.00.0030.0206.88

preferences:
55.52 ms | 400 KiB | 5 Q