3v4l.org

run code in 300+ PHP versions simultaneously
<?php $hotels = [ ['Auditor', 1, 8.4, 21176], ['Everest', 2, 8.2, 21176], ['Guiboli', 2, 8.0, 21781], ['Florida', 2, 8.0, 22154], ['Guiliano', 2, 8.5, 23033], ['Marielen', 2, 8.3, 24015], ['max', 3, 8.2, 24253], ['Pratti', 2, 8.1, 24434], ['Everest inn', 2, 8.1, 24807], ['Olbeminele', 3, 8.4, 24965], ]; $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.75
8.3.50.0070.00922.01
8.3.40.0040.01118.82
8.3.30.0090.00919.09
8.3.20.0050.00320.46
8.3.10.0050.00323.73
8.3.00.0080.00019.50
8.2.180.0130.00618.29
8.2.170.0120.00322.96
8.2.160.0110.00320.52
8.2.150.0080.00024.18
8.2.140.0080.00024.66
8.2.130.0040.00426.16
8.2.120.0050.00322.25
8.2.110.0060.00319.37
8.2.100.0120.00017.84
8.2.90.0030.00519.34
8.2.80.0060.00317.97
8.2.70.0040.00417.75
8.2.60.0040.00417.93
8.2.50.0000.00818.07
8.2.40.0050.00518.47
8.2.30.0000.00718.17
8.2.20.0050.00317.89
8.2.10.0020.00518.31
8.2.00.0050.00617.87
8.1.280.0120.00325.92
8.1.270.0040.00422.39
8.1.260.0050.00326.35
8.1.250.0080.00028.09
8.1.240.0120.00622.34
8.1.230.0100.00322.82
8.1.220.0030.00517.79
8.1.210.0080.00018.77
8.1.200.0030.00617.38
8.1.190.0050.00317.55
8.1.180.0050.00318.10
8.1.170.0030.00718.51
8.1.160.0000.00722.17
8.1.150.0000.00718.67
8.1.140.0040.00417.48
8.1.130.0000.00717.98
8.1.120.0070.00017.64
8.1.110.0070.00017.48
8.1.100.0030.00517.58
8.1.90.0040.00417.48
8.1.80.0000.00717.46
8.1.70.0030.00317.53
8.1.60.0030.00517.70
8.1.50.0030.00617.60
8.1.40.0050.00317.62
8.1.30.0050.00317.62
8.1.20.0000.00817.67
8.1.10.0030.00517.71
8.1.00.0030.00517.64
8.0.300.0000.00718.77
8.0.290.0000.00717.43
8.0.280.0000.00718.55
8.0.270.0050.00317.34
8.0.260.0030.00317.26
8.0.250.0040.00417.11
8.0.240.0030.00317.11
8.0.230.0000.00716.97
8.0.220.0000.00716.92
8.0.210.0000.00716.93
8.0.200.0070.00017.07
8.0.190.0040.00417.09
8.0.180.0060.00317.00
8.0.170.0030.00616.95
8.0.160.0050.00316.91
8.0.150.0040.00416.93
8.0.140.0040.00416.81
8.0.130.0030.00313.48
8.0.120.0030.00516.88
8.0.110.0030.00517.03
8.0.100.0030.00516.90
8.0.90.0040.00417.05
8.0.80.0110.00616.89
8.0.70.0060.00317.05
8.0.60.0050.00316.91
8.0.50.0080.00016.96
8.0.30.0110.01217.29
8.0.20.0120.00917.40
8.0.10.0000.00817.03
8.0.00.0150.00616.94
7.4.330.0000.00515.00
7.4.320.0040.00416.64
7.4.300.0030.00316.73
7.4.290.0000.00816.66
7.4.280.0030.00516.63
7.4.270.0000.00716.77
7.4.260.0030.00316.62
7.4.250.0060.00316.59
7.4.240.0030.00316.74
7.4.230.0000.00716.83
7.4.220.0120.00616.66
7.4.210.0130.00316.66
7.4.200.0030.00316.73
7.4.190.0000.00716.69
7.4.160.0140.00516.67
7.4.150.0060.01317.40
7.4.140.0160.00717.86
7.4.130.0080.01016.73
7.4.120.0080.01316.60
7.4.110.0200.00016.75
7.4.100.0060.01316.54
7.4.90.0150.01216.54
7.4.80.0070.01419.39
7.4.70.0100.00716.66
7.4.60.0130.01016.63
7.4.50.0030.00516.77
7.4.40.0030.01022.77
7.4.30.0130.00316.66
7.4.00.0070.00914.93
7.3.330.0000.00613.45
7.3.320.0030.00313.46
7.3.310.0000.00816.48
7.3.300.0040.00416.33
7.3.290.0100.00616.45
7.3.280.0060.01516.44
7.3.270.0110.01417.40
7.3.260.0200.00016.51
7.3.250.0100.00816.61
7.3.240.0120.01216.53
7.3.230.0090.00916.61
7.3.210.0140.00316.47
7.3.200.0200.00319.39
7.3.190.0070.01116.78
7.3.180.0070.01116.46
7.3.170.0030.01316.66
7.3.160.0050.01116.44
7.3.120.0040.01514.94
7.3.110.0080.00615.08
7.3.100.0130.00314.65
7.3.90.0070.00414.71
7.3.80.0030.01215.01
7.3.70.0040.01114.86
7.3.60.0050.00514.76
7.3.50.0030.01414.88
7.3.40.0000.01714.86
7.3.30.0090.00614.64
7.3.20.0090.00616.52
7.3.10.0030.00616.88
7.3.00.0060.00616.71
7.2.330.0120.00816.75
7.2.320.0030.02116.75
7.2.310.0190.00516.73
7.2.300.0110.00816.61
7.2.290.0130.01016.60
7.2.250.0100.01015.00
7.2.240.0150.00715.08
7.2.230.0030.01315.22
7.2.220.0000.01014.85
7.2.210.0060.01215.29
7.2.200.0040.01515.14
7.2.190.0070.01015.07
7.2.180.0000.01815.11
7.2.170.0070.01115.17
7.2.60.0070.00717.04
7.2.00.0000.01319.49
7.1.330.0130.00315.62
7.1.320.0120.00616.04
7.1.310.0090.00615.90
7.1.300.0080.00415.86
7.1.290.0040.01415.88
7.1.280.0030.00915.82
7.1.270.0110.00415.78
7.1.260.0100.00615.63
7.1.200.0000.01515.68
7.1.100.0030.00918.13
7.1.70.0070.00017.16
7.1.60.0030.02319.33
7.1.50.0120.01216.85
7.1.00.0100.06722.48
7.0.200.0030.00614.88
7.0.140.0070.06722.15
7.0.60.0070.08320.05
7.0.50.0070.06317.89
7.0.40.0130.04320.23
7.0.30.0230.06720.27
7.0.20.0200.06020.25
7.0.10.0070.07320.21
7.0.00.0030.04320.23
5.6.280.0070.07320.84
5.6.210.0070.04320.77
5.6.200.0030.05318.18
5.6.190.0030.04320.61
5.6.180.0100.05020.52
5.6.170.0230.06720.53
5.6.160.0070.05320.58
5.6.150.0030.05318.25
5.6.140.0130.08018.17
5.6.130.0030.07318.18
5.6.120.0070.07321.02
5.6.110.0170.07321.03
5.6.100.0070.07721.00
5.6.90.0170.07321.14
5.6.80.0070.08320.45
5.6.70.1300.02720.42
5.5.350.0030.07720.41
5.5.340.0070.07017.94
5.5.330.0070.05320.37
5.5.320.0200.06020.52
5.5.310.0070.05020.47
5.5.300.0100.07718.02
5.5.290.0170.07317.95
5.5.280.0030.08320.83
5.5.270.0030.05320.79
5.5.260.0070.08320.98
5.5.250.0070.08320.71
5.5.240.0170.07320.09
5.4.450.0930.06319.47
5.4.440.0830.06719.68
5.4.430.0930.06719.61
5.4.420.0830.06019.48
5.4.410.0730.06319.66
5.4.400.0170.05319.13
5.4.390.0770.05719.14
5.4.380.0270.05718.63
5.4.370.0270.05718.59
5.4.360.0230.05718.71
5.4.350.0200.06718.59
5.4.340.0370.04018.71
5.4.320.0080.04512.53
5.4.310.0070.03812.53
5.4.300.0090.03912.53
5.4.290.0050.03912.52
5.4.280.0090.03512.39
5.4.270.0150.09412.40
5.4.260.0110.04312.39
5.4.250.0070.05812.40
5.4.240.0080.05612.40
5.4.230.0090.05312.39
5.4.220.0120.05712.39
5.4.210.0070.05312.39
5.4.200.0100.05312.39
5.4.190.0070.05612.39
5.4.180.0120.04412.39
5.4.170.0120.05212.40
5.4.160.0090.05012.39
5.4.150.0090.04112.39
5.4.140.0120.05912.08
5.4.130.0120.04012.07
5.4.120.0070.05912.02
5.4.110.0150.07412.02
5.4.100.0190.05312.02
5.4.90.0070.05512.02
5.4.80.0120.06012.01
5.4.70.0180.05612.02
5.4.60.0200.07012.02
5.4.50.0060.07312.02
5.4.40.0180.07912.00
5.4.30.0080.05312.00
5.4.20.0110.05512.00
5.4.10.0100.05911.99
5.4.00.0100.05011.49
5.3.290.0050.03912.80
5.3.280.0110.07312.71
5.3.270.0150.05112.73
5.3.260.0070.05812.72
5.3.250.0100.05312.72
5.3.240.0160.05512.72
5.3.230.0100.05512.71
5.3.220.0050.04212.68
5.3.210.0050.04412.68
5.3.200.0110.03612.68
5.3.190.0090.05412.68
5.3.180.0230.09112.67
5.3.170.0100.05112.67
5.3.160.0110.05512.67
5.3.150.0200.05612.67
5.3.140.0120.05812.66
5.3.130.0090.05312.66
5.3.120.0080.04812.66
5.3.110.0110.04912.66
5.3.100.0070.04012.12
5.3.90.0030.04412.08
5.3.80.0270.05712.08
5.3.70.0090.04112.07
5.3.60.0100.04312.07
5.3.50.0090.03712.00
5.3.40.0060.03912.00
5.3.30.0110.03511.94
5.3.20.0040.04411.70
5.3.10.0090.04011.67
5.3.00.0090.04011.66
5.2.170.0080.0359.15
5.2.160.0170.0469.16
5.2.150.0090.0469.15
5.2.140.0050.0439.14
5.2.130.0070.0439.11
5.2.120.0080.0409.11
5.2.110.0130.0509.12
5.2.100.0180.0589.11
5.2.90.0080.0399.11
5.2.80.0140.0639.11
5.2.70.0100.0369.11
5.2.60.0110.0439.05
5.2.50.0160.0599.04
5.2.40.0130.0499.00
5.2.30.0050.0378.98
5.2.20.0100.0268.97
5.2.10.0070.0298.91
5.2.00.0090.0428.76
5.1.60.0130.0418.05
5.1.50.0090.0308.05
5.1.40.0130.0458.02
5.1.30.0040.0448.38
5.1.20.0140.0558.40
5.1.10.0070.0388.13
5.1.00.0090.0448.13
5.0.50.0060.0306.60
5.0.40.0040.0366.46
5.0.30.0050.0436.27
5.0.20.0080.0256.25
5.0.10.0070.0246.22
5.0.00.0050.0426.21
4.4.90.0030.0234.78
4.4.80.0110.0424.75
4.4.70.0060.0294.75
4.4.60.0070.0154.75
4.4.50.0080.0184.77
4.4.40.0050.0344.71
4.4.30.0040.0264.76
4.4.20.0050.0234.84
4.4.10.0050.0234.85
4.4.00.0060.0394.75
4.3.110.0060.0244.67
4.3.100.0030.0234.66
4.3.90.0050.0194.63
4.3.80.0050.0384.58
4.3.70.0030.0244.63
4.3.60.0060.0224.63
4.3.50.0070.0284.62
4.3.40.0050.0344.54
4.3.30.0030.0173.27
4.3.20.0030.0243.25
4.3.10.0000.0253.21
4.3.00.0170.01310.37

preferences:
61.89 ms | 401 KiB | 5 Q