3v4l.org

run code in 300+ PHP versions simultaneously
<?php // camel case the class name class Smth { // changed the static class variables to constants const MARK_UNDEFINED = 'Undefined'; const MARK_F = 'ECTS-F'; const MARK_FX = 'ECTS-FX'; const MARK_E = 'ECTS-E'; const MARK_D = 'ECTS-D'; const MARK_C = 'ECTS-C'; const MARK_B = 'ECTS-B'; const MARK_A = 'ECTS-A'; // changed the protected method to public(no discernable reason to make it protected) // changed the function name to camel case public function getEctsMark($rate, $current, $examRate) { // moved this here to save us going through 2 if statements if($current > 0 && $examRate < 22) { return self::MARK_FX; } // the rest is the same as it was originally. $color = self::MARK_UNDEFINED; if ($current > 0) { $percent = $rate / $current; if ($percent < 0.31) { $color = self::MARK_F; } elseif ($percent < 0.60) { $color = self::MARK_FX; } elseif ($percent < 0.65) { $color = self::MARK_E; } elseif ($percent < 0.71) { $color = self::MARK_D; } elseif ($percent < 0.85) { $color = self::MARK_C; } elseif ($percent < 0.95) { $color = self::MARK_B; } else { $color = self::MARK_A; } } return $color; } }

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.4.130.0100.01117.93
8.4.120.0110.00924.27
8.4.110.0040.00718.97
8.4.100.0130.00717.61
8.4.90.0130.00918.73
8.4.80.0030.00517.70
8.4.70.0090.00817.77
8.4.60.0060.00220.20
8.4.50.0090.01119.47
8.4.40.0090.01017.61
8.4.30.0100.01017.21
8.4.20.0100.01017.53
8.4.10.0130.00317.56
8.3.260.0100.00916.35
8.3.250.0130.00618.64
8.3.240.0130.00617.18
8.3.230.0110.00816.43
8.3.220.0070.00316.95
8.3.210.0030.00516.83
8.3.200.0020.00616.48
8.3.190.0110.00717.22
8.3.180.0080.01116.34
8.3.170.0140.00418.97
8.3.160.0150.00318.21
8.3.150.0110.00718.66
8.3.140.0000.00816.61
8.3.130.0080.00018.06
8.3.120.0130.00720.49
8.3.110.0000.00816.41
8.3.100.0080.00016.64
8.3.90.0040.00426.77
8.3.80.0080.00316.63
8.3.70.0100.01016.58
8.3.60.0100.01018.43
8.3.50.0100.01421.94
8.3.40.0100.01018.72
8.3.30.0030.01018.96
8.3.20.0070.00020.18
8.3.10.0080.00021.96
8.3.00.0040.00419.19
8.2.290.0040.00420.15
8.2.280.0110.00918.39
8.2.270.0030.00616.53
8.2.260.0120.00618.95
8.2.250.0080.00816.46
8.2.240.0000.00816.56
8.2.230.0170.00020.94
8.2.220.0080.00024.06
8.2.210.0090.00026.77
8.2.200.0100.00018.16
8.2.190.0140.00416.63
8.2.180.0140.00725.92
8.2.170.0070.00718.63
8.2.160.0170.00022.96
8.2.150.0170.00324.18
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0040.00419.89
8.2.110.0030.00622.25
8.2.100.0090.00317.66
8.2.90.0040.00422.15
8.2.80.0080.00017.97
8.2.70.0050.00317.91
8.2.60.0060.00617.97
8.2.50.0070.00018.10
8.2.40.0040.00418.99
8.2.30.0040.00419.22
8.2.20.0000.00717.61
8.2.10.0050.00217.88
8.2.00.0080.00017.50
8.1.330.0110.00821.76
8.1.320.0090.01016.15
8.1.310.0050.00316.68
8.1.300.0080.00018.10
8.1.290.0060.00330.84
8.1.280.0030.01325.92
8.1.270.0160.00318.75
8.1.260.0040.00426.35
8.1.250.0080.00028.09
8.1.240.0110.00020.57
8.1.230.0040.00820.95
8.1.220.0080.00017.74
8.1.210.0030.00618.85
8.1.200.0040.00417.23
8.1.190.0090.00017.10
8.1.180.0040.00418.10
8.1.170.0000.00818.50
8.1.160.0040.00418.75
8.1.150.0000.00718.80
8.1.140.0070.00017.29
8.1.130.0040.00417.80
8.1.120.0000.00717.44
8.1.110.0000.00817.41
8.1.100.0030.00417.38
8.1.90.0020.00517.39
8.1.80.0030.00317.33
8.1.70.0030.00317.29
8.1.60.0030.00517.45
8.1.50.0000.00817.38
8.1.40.0040.00417.45
8.1.30.0030.00517.58
8.1.20.0080.00017.49
8.1.10.0050.00317.34
8.1.00.0050.00317.37
8.0.300.0060.00319.94
8.0.290.0000.00716.63
8.0.280.0030.00318.42
8.0.270.0060.00317.23
8.0.260.0050.00317.09
8.0.250.0000.00716.87
8.0.240.0080.00016.86
8.0.230.0000.00716.87
8.0.220.0070.00016.87
8.0.210.0020.00516.79
8.0.200.0070.00016.75
8.0.190.0030.00616.76
8.0.180.0030.00616.83
8.0.170.0050.00316.90
8.0.160.0000.00716.74
8.0.150.0030.00316.64
8.0.140.0070.00316.81
8.0.130.0060.00013.16
8.0.120.0100.00016.80
8.0.110.0000.00716.81
8.0.100.0060.00316.60
8.0.90.0040.00416.81
8.0.80.0100.01016.73
8.0.70.0050.00316.92
8.0.60.0000.00716.70
8.0.50.0040.00416.79
8.0.30.0080.01317.08
8.0.20.0110.00917.40
8.0.10.0060.00316.90
8.0.00.0090.00916.64
7.4.330.0000.00615.11
7.4.320.0070.00016.44
7.4.300.0060.00016.36
7.4.290.0000.00716.43
7.4.280.0050.00216.42
7.4.270.0000.00616.42
7.4.260.0000.00816.41
7.4.250.0040.00416.25
7.4.240.0040.00416.46
7.4.230.0000.00716.61
7.4.220.0130.00616.46
7.4.210.0100.00416.45
7.4.200.0000.00716.54
7.4.150.0100.00717.40
7.4.140.0040.01617.86
7.4.130.0090.00916.36
7.4.120.0110.00516.38
7.4.110.0070.01016.53
7.4.100.0120.00916.27
7.4.90.0070.01016.55
7.4.80.0140.01016.46
7.4.70.0120.00916.23
7.4.60.0100.00616.44
7.4.50.0040.00416.63
7.4.40.0130.01016.38
7.4.30.0040.01216.34
7.4.00.0070.01015.14
7.3.330.0000.00713.17
7.3.320.0030.00313.18
7.3.310.0030.00516.02
7.3.300.0070.00016.21
7.3.290.0080.00616.19
7.3.280.0120.00516.23
7.3.270.0130.00317.40
7.3.260.0140.00516.26
7.3.250.0140.00816.28
7.3.240.0130.00316.36
7.3.230.0080.00816.39
7.3.210.0140.00316.47
7.3.200.0060.01119.39
7.3.190.0120.00316.11
7.3.180.0030.01416.28
7.3.170.0170.00916.29
7.3.160.0140.00316.43
7.3.120.0030.00914.61
7.3.110.0070.00714.39
7.3.100.0070.00714.64
7.3.90.0000.01514.54
7.3.80.0130.00314.61
7.3.70.0030.01314.59
7.3.60.0040.01114.75
7.3.50.0030.00914.70
7.3.40.0160.00014.53
7.3.30.0070.00314.58
7.3.20.0100.00316.57
7.3.10.0050.00916.60
7.3.00.0080.00516.62
7.2.330.0160.00316.31
7.2.320.0070.01016.53
7.2.310.0130.00916.22
7.2.300.0070.01616.21
7.2.290.0140.00316.38
7.2.240.0030.00614.68
7.2.230.0040.01114.54
7.2.220.0050.00514.50
7.2.210.0030.00714.94
7.2.200.0000.01214.68
7.2.190.0040.00714.88
7.2.180.0070.00714.72
7.2.170.0070.00314.93
7.2.160.0060.00914.69
7.2.150.0060.00616.76
7.2.140.0130.00316.64
7.2.130.0070.00416.78
7.2.120.0040.00916.58
7.2.110.0020.01216.71
7.2.100.0040.00816.71
7.2.90.0050.00916.69
7.2.80.0030.00916.71
7.2.70.0000.01116.46
7.2.60.0060.00616.61
7.2.50.0030.01016.72
7.2.40.0080.00616.63
7.2.30.0030.01016.85
7.2.20.0000.01316.70
7.2.10.0030.01016.74
7.2.00.0080.00516.66
7.1.330.0040.01115.58
7.1.320.0040.00815.38
7.1.310.0000.01315.48
7.1.300.0030.01215.55
7.1.290.0080.00915.38
7.1.280.0030.01515.43
7.1.270.0030.01215.27
7.1.260.0030.01415.62
7.1.250.0070.00515.46
7.1.200.0030.01015.64
7.1.100.0040.01117.62
7.1.70.0030.00616.84
7.1.60.0110.01519.57
7.1.50.0060.01916.46
7.1.00.0070.07022.27
7.0.200.0000.00816.71
7.0.140.0000.05321.95
7.0.100.0070.08320.05
7.0.90.0270.08319.96
7.0.80.0100.07319.98
7.0.70.0200.07719.99
7.0.60.0000.08020.09
7.0.50.0200.07320.16
7.0.40.0170.08020.07
7.0.30.0100.06719.96
7.0.20.0100.07020.13
7.0.10.0030.06020.06
7.0.00.0130.07020.12
5.6.280.0000.07321.13
5.6.250.0000.07320.73
5.6.240.0130.04320.71
5.6.230.0100.08020.61
5.6.220.0030.08320.68
5.6.210.0070.08320.76
5.6.200.0200.07021.12
5.6.190.0070.07021.04
5.6.180.0070.08321.11
5.6.170.0070.08720.97
5.6.160.0030.08721.06
5.6.150.0070.08021.07
5.6.140.0170.08021.05
5.6.130.0000.08721.05
5.6.120.0030.08721.18
5.6.110.0200.06721.08
5.6.100.0030.08020.95
5.6.90.0070.08321.11
5.6.80.0070.06720.41
5.6.70.0100.07020.42
5.6.60.0200.06720.51
5.6.50.0170.06320.45
5.6.40.0000.05020.41
5.6.30.0030.07020.39
5.6.20.0070.08320.50
5.6.10.0070.07020.30
5.6.00.0200.05020.35
5.5.380.0070.07720.36
5.5.370.0030.08720.43
5.5.360.0030.08020.56
5.5.350.0100.06320.45
5.5.340.0170.05320.89
5.5.330.0070.07720.79
5.5.320.0070.08320.85
5.5.310.0130.04320.93
5.5.300.0070.04720.90
5.5.290.0000.06020.82
5.5.280.0030.07020.77
5.5.270.0170.04320.87
5.5.260.0070.04720.88
5.5.250.0170.06720.55
5.5.240.0100.07320.23
5.5.230.0100.06020.26
5.5.220.0170.06020.26
5.5.210.0070.04320.29
5.5.200.0170.05320.00
5.5.190.0170.04020.29
5.5.180.0070.05020.09
5.5.160.0100.06020.18
5.5.150.0100.08019.98
5.5.140.0030.08720.25
5.5.130.0070.08020.22
5.5.120.0200.03320.23
5.5.110.0070.08020.27
5.5.100.0100.07020.12
5.5.90.0200.06320.19
5.5.80.0000.08720.07
5.5.70.0070.05720.07
5.5.60.0100.07320.01
5.5.50.0130.07020.06
5.5.40.0070.07719.93
5.5.30.0170.07320.13
5.5.20.0130.06720.05
5.5.10.0130.07720.09
5.5.00.0100.06320.11
5.4.450.0070.08719.46
5.4.440.0100.08319.37
5.4.430.0030.08319.50
5.4.420.0070.06019.30
5.4.410.0000.08719.24
5.4.400.0130.03719.05
5.4.390.0070.04718.88
5.4.380.0070.04718.90
5.4.370.0130.04018.88
5.4.360.0000.05718.95
5.4.350.0070.06319.03
5.4.340.0170.06719.18
5.4.320.0100.07019.16
5.4.310.0070.04318.95
5.4.300.0000.05719.12
5.4.290.0030.07718.95
5.4.280.0130.06719.21
5.4.270.0070.04019.13
5.4.260.0070.08019.23
5.4.250.0000.04319.03
5.4.240.0170.06318.88
5.4.230.0070.04719.21
5.4.220.0070.07019.12
5.4.210.0030.06019.04
5.4.200.0000.08018.88
5.4.190.0030.04019.02
5.4.180.0070.07719.20
5.4.170.0070.07319.04
5.4.160.0030.05019.03
5.4.150.0030.07718.86
5.4.140.0070.07316.50
5.4.130.0100.04316.31
5.4.120.0070.05316.49
5.4.110.0100.06016.27
5.4.100.0170.06316.32
5.4.90.0030.04016.32
5.4.80.0070.04016.33
5.4.70.0100.03716.32
5.4.60.0170.04316.40
5.4.50.0170.03716.44
5.4.40.0100.06016.50
5.4.30.0100.06716.48
5.4.20.0000.07316.50
5.4.10.0000.08316.47
5.4.00.0030.06715.90
5.3.290.0130.06714.76
5.3.280.0070.06714.59
5.3.270.0030.07714.56
5.3.260.0100.07314.64
5.3.250.0030.07014.54
5.3.240.0100.03714.72
5.3.230.0100.07314.61
5.3.220.0070.08014.50
5.3.210.0030.04714.58
5.3.200.0030.04314.64
5.3.190.0030.03714.66
5.3.180.0030.04014.49
5.3.170.0030.05314.54
5.3.160.0030.07714.50
5.3.150.0030.08014.52
5.3.140.0070.08014.70
5.3.130.0130.07314.54
5.3.120.0070.07014.48
5.3.110.0100.07014.64
5.3.100.0030.08014.04
5.3.90.0030.04314.14
5.3.80.0170.05714.08
5.3.70.0030.04314.08
5.3.60.0000.05713.93
5.3.50.0030.06014.04
5.3.40.0130.03313.93
5.3.30.0070.05313.90
5.3.20.0130.06713.71
5.3.10.0100.06713.71
5.3.00.0130.06313.73
5.2.170.0100.05711.25
5.2.160.0030.03311.27
5.2.150.0070.06011.06
5.2.140.0170.04711.03
5.2.130.0000.03311.23
5.2.120.0100.05311.21
5.2.110.0030.06711.20
5.2.100.0000.06710.99
5.2.90.0030.05711.02
5.2.80.0100.06011.03
5.2.70.0000.07011.16
5.2.60.0000.06011.11
5.2.50.0030.06310.94
5.2.40.0000.03711.08
5.2.30.0070.05310.98
5.2.20.0030.02710.88
5.2.10.0130.01710.92
5.2.00.0000.03010.80
5.1.60.0070.02010.08
5.1.50.0030.02710.06
5.1.40.0000.0239.96
5.1.30.0030.04710.37
5.1.20.0000.02710.31
5.1.10.0070.02310.11
5.1.00.0070.02310.08
5.0.50.0030.0208.55
5.0.40.0000.0208.54
5.0.30.0030.0278.32
5.0.20.0000.0208.29
5.0.10.0030.0178.26
5.0.00.0030.0578.14
4.4.90.0000.0378.14
4.4.80.0000.0308.14
4.4.70.0070.0108.14
4.4.60.0000.0178.14
4.4.50.0000.0178.14
4.4.40.0030.0208.14
4.4.30.0000.0178.14
4.4.20.0030.0138.14
4.4.10.0070.0138.14
4.4.00.0000.0278.14
4.3.110.0030.0138.14
4.3.100.0030.0138.14
4.3.90.0030.0138.14
4.3.80.0000.0238.14
4.3.70.0070.0178.14
4.3.60.0070.0208.14
4.3.50.0030.0208.14
4.3.40.0000.0408.14
4.3.30.0070.0108.14
4.3.20.0000.0138.14
4.3.10.0000.0238.14
4.3.00.0030.0338.14

preferences:
138.25 ms | 403 KiB | 5 Q