3v4l.org

run code in 300+ PHP versions simultaneously
<?php function ColorLuminance($hex, $lum) { // validate hex string $hex = preg_replace("/[^0-9a-f]/i", "", $hex); if (strlen($hex) < 6) { $hex = $hex[0] + $hex[0] + $hex[1] + $hex[1] + $hex[2] + $hex[2]; } // convert to decimal and change luminosity $rgb = "#"; for ($i = 0; $i < 3; $i++) { echo substr($hex, $i * 2, 2) . " * "; $c = base_convert(substr($hex, $i * 2, 2), 16, 10); echo $c . " - "; $c = base_convert((round(min(max(0, floatval($c + ($c * $lum))),255))), 10, 16); echo $c . " - "; $rgb .= substr('00' + $c, strlen($c)); echo $rgb . " - "; } return $rgb; } echo ColorLuminance("#69c", 0) . "\n"; // returns "#6699cc" /*echo ColorLuminance("6699CC", 0.2) . "\n";// "#7ab8f5" - 20% lighter echo ColorLuminance("69C", -0.5) . "\n";// "#334d66" - 50% darker echo ColorLuminance("000", 1) . "\n";// "#000000" - true black cannot be made lighter!*/

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.0140.00418.43
8.3.50.0130.00722.05
8.3.40.0070.01418.95
8.3.30.0140.00319.07
8.3.20.0040.00420.34
8.3.10.0040.00423.48
8.3.00.0060.00319.68
8.2.180.0040.01117.00
8.2.170.0140.00322.96
8.2.160.0120.00420.35
8.2.150.0040.00424.18
8.2.140.0030.00624.66
8.2.130.0040.00426.16
8.2.120.0000.00820.97
8.2.110.0100.00722.08
8.2.100.0040.00720.27
8.2.90.0050.00319.19
8.2.80.0080.00017.97
8.2.70.0080.00017.75
8.2.60.0040.00417.90
8.2.50.0060.00318.07
8.2.40.0040.00418.22
8.2.30.0000.00718.26
8.2.20.0030.00517.92
8.2.10.0030.00618.08
8.2.00.0000.00817.97
8.1.280.0060.00925.92
8.1.270.0060.00323.96
8.1.260.0040.00426.35
8.1.250.0000.00828.09
8.1.240.0030.00622.03
8.1.230.0040.00718.97
8.1.220.0000.00817.74
8.1.210.0030.00518.77
8.1.200.0060.00317.35
8.1.190.0050.00317.36
8.1.180.0000.00818.10
8.1.170.0040.00418.62
8.1.160.0060.00321.86
8.1.150.0000.00718.86
8.1.140.0070.00017.54
8.1.130.0030.00317.91
8.1.120.0040.00417.46
8.1.110.0000.00817.59
8.1.100.0080.00017.55
8.1.90.0050.00317.56
8.1.80.0000.00717.54
8.1.70.0030.00317.48
8.1.60.0060.00317.77
8.1.50.0040.00417.70
8.1.40.0040.00417.69
8.1.30.0030.00517.76
8.1.20.0040.00417.85
8.1.10.0050.00317.62
8.1.00.0000.00717.69
8.0.300.0070.00018.77
8.0.290.0040.00416.75
8.0.280.0000.00718.41
8.0.270.0080.00017.29
8.0.260.0000.00717.23
8.0.250.0030.00317.02
8.0.240.0040.00417.00
8.0.230.0000.00716.98
8.0.220.0000.00717.04
8.0.210.0070.00016.94
8.0.200.0000.00817.09
8.0.190.0030.00717.11
8.0.180.0100.00017.04
8.0.170.0040.00417.06
8.0.160.0040.00416.95
8.0.150.0040.00416.95
8.0.140.0050.00316.91
8.0.130.0000.00513.43
8.0.120.0000.00717.04
8.0.110.0040.00417.07
8.0.100.0040.00417.00
8.0.90.0020.00516.86
8.0.80.0090.01217.09
8.0.70.0030.00516.90
8.0.60.0040.00417.02
8.0.50.0030.00517.16
8.0.30.0100.00817.28
8.0.20.0160.00617.43
8.0.10.0030.00517.07
8.0.00.0130.00616.96
7.4.330.0000.00515.24
7.4.320.0000.00716.79
7.4.300.0040.00416.86
7.4.290.0000.00716.68
7.4.280.0100.00016.69
7.4.270.0000.00716.80
7.4.260.0000.00816.78
7.4.250.0040.00416.84
7.4.240.0020.00516.79
7.4.230.0000.00716.67
7.4.220.0110.00716.89
7.4.210.0070.00716.87
7.4.200.0030.00316.70
7.4.160.0060.01016.68
7.4.150.0040.01317.40
7.4.140.0110.00717.86
7.4.130.0110.00616.86
7.4.120.0060.01316.74
7.4.110.0110.00716.70
7.4.100.0060.01216.81
7.4.90.0090.00916.86
7.4.80.0100.01019.39
7.4.70.0180.00416.67
7.4.60.0060.00916.69
7.4.50.0040.00416.93
7.4.40.0060.00916.73
7.4.30.0100.00716.95
7.4.10.0070.01115.12
7.4.00.0090.00715.21
7.3.330.0040.00213.63
7.3.320.0050.00013.62
7.3.310.0030.00316.63
7.3.300.0030.00316.67
7.3.290.0120.00616.68
7.3.280.0060.01316.65
7.3.270.0040.01517.40
7.3.260.0110.00816.66
7.3.250.0070.00916.71
7.3.240.0100.01616.80
7.3.230.0070.01116.76
7.3.210.0140.00516.85
7.3.200.0120.00619.39
7.3.190.0080.01116.95
7.3.180.0100.00716.64
7.3.170.0040.01216.74
7.3.160.0060.00916.86
7.3.130.0060.01315.23
7.3.120.0090.00715.05
7.3.110.0030.01315.04
7.3.100.0030.01515.06
7.3.90.0070.00914.97
7.3.80.0100.00615.08
7.3.70.0080.00415.04
7.3.60.0050.01215.01
7.3.50.0060.00714.99
7.3.40.0090.00514.83
7.3.30.0040.00814.88
7.3.20.0030.01116.94
7.3.10.0060.00816.89
7.3.00.0090.00316.88
7.2.330.0090.01016.93
7.2.320.0120.00616.94
7.2.310.0110.00517.06
7.2.300.0130.00316.91
7.2.290.0100.00716.95
7.2.260.0100.01015.32
7.2.250.0080.01115.16
7.2.240.0060.01115.13
7.2.230.0080.00615.28
7.2.220.0010.01315.39
7.2.210.0090.00815.17
7.2.200.0040.00715.33
7.2.190.0060.00715.34
7.2.180.0050.00815.28
7.2.170.0040.00915.31
7.2.160.0100.00515.10
7.2.150.0080.00517.07
7.2.140.0090.00716.89
7.2.130.0060.00717.11
7.2.120.0030.01217.26
7.2.110.0080.00817.16
7.2.100.0060.00817.09
7.2.90.0080.00917.19
7.2.80.0060.00817.14
7.2.70.0070.01016.96
7.2.60.0060.01017.01
7.2.50.0060.00817.21
7.2.40.0080.00617.24
7.2.30.0020.01117.22
7.2.20.0090.00417.02
7.2.10.0070.00817.17
7.2.00.0060.00818.07
7.1.330.0060.01015.97
7.1.320.0050.00716.03
7.1.310.0090.00515.96
7.1.300.0040.01116.01
7.1.290.0050.00915.93
7.1.280.0040.00915.80
7.1.270.0050.01015.99
7.1.260.0060.00815.88
7.1.250.0070.00616.11
7.1.240.0090.00515.78
7.1.230.0050.01015.77
7.1.220.0090.00316.00
7.1.210.0030.01016.00
7.1.200.0020.01216.03
7.1.190.0050.00816.01
7.1.180.0080.00916.07
7.1.170.0030.01215.77
7.1.160.0060.00516.01
7.1.150.0030.01015.96
7.1.140.0060.00615.98
7.1.130.0030.01016.00
7.1.120.0050.00815.80
7.1.110.0060.00315.92
7.1.100.0120.00316.76
7.1.90.0040.01315.89
7.1.80.0070.00615.90
7.1.70.0030.00816.47
7.1.60.0060.00917.27
7.1.50.0080.00916.24
7.1.40.0030.00715.84
7.1.30.0030.01115.95
7.1.20.0020.01016.06
7.1.10.0060.00715.98
7.1.00.0080.02818.20
7.0.330.0050.00815.67
7.0.320.0050.00615.46
7.0.310.0080.00415.65
7.0.300.0090.00515.68
7.0.290.0050.00715.59
7.0.280.0050.00615.53
7.0.270.0040.00915.44
7.0.260.0020.00815.46
7.0.250.0050.00815.55
7.0.240.0080.00515.69
7.0.230.0080.00815.69
7.0.220.0050.01015.54
7.0.210.0040.00815.75
7.0.200.0040.00815.90
7.0.190.0030.00915.75
7.0.180.0060.00715.61
7.0.170.0050.00615.61
7.0.160.0040.00515.58
7.0.150.0060.00415.41
7.0.140.0090.02417.74
7.0.130.0020.00915.58
7.0.120.0060.00615.69
7.0.110.0030.00815.73
7.0.100.0060.00415.46
7.0.90.0070.00415.63
7.0.80.0020.01015.35
7.0.70.0000.01115.56
7.0.60.0030.02117.20
7.0.50.0080.02816.33
7.0.40.0090.03015.95
7.0.30.0120.02315.70
7.0.20.0120.01715.78
7.0.10.0070.03215.77
7.0.00.0040.03515.86
5.6.400.0070.00514.79
5.6.390.0090.00314.51
5.6.380.0050.00714.44
5.6.370.0060.01114.80
5.6.360.0060.00814.34
5.6.350.0090.00414.42
5.6.340.0090.00414.43
5.6.330.0100.00214.26
5.6.320.0070.00514.60
5.6.310.0080.00614.65
5.6.300.0070.00514.45
5.6.290.0110.00314.69
5.6.280.0060.02616.74
5.6.270.0030.00814.64
5.6.260.0040.00714.42
5.6.250.0020.01014.54
5.6.240.0050.01114.57
5.6.230.0090.00614.46
5.6.220.0090.00514.55
5.6.210.0100.02816.45
5.6.200.0110.03015.71
5.6.190.0050.02616.37
5.6.180.0220.03016.50
5.6.170.0140.02516.34
5.6.160.0130.02416.46
5.6.150.0040.02915.65
5.6.140.0030.03415.87
5.6.130.0090.03415.68
5.6.120.0030.02516.68
5.6.110.0080.02816.86
5.6.100.0090.03216.69
5.6.90.0050.01716.58
5.6.80.0050.01716.36
5.6.70.0070.00714.67
5.6.60.0090.00514.37
5.6.50.0080.00714.37
5.6.40.0000.01214.53
5.6.30.0050.00914.43
5.6.20.0050.00914.43
5.6.10.0040.00814.46
5.6.00.0070.00614.32
5.5.380.0070.00714.67
5.5.370.0050.00514.30
5.5.360.0030.00814.37
5.5.350.0100.02016.50
5.5.340.0040.03315.73
5.5.330.0040.01916.33
5.5.320.0050.01716.40
5.5.310.0090.02216.45
5.5.300.0080.03215.62
5.5.290.0070.02915.66
5.5.280.0090.02316.55
5.5.270.0120.02716.53
5.5.260.0040.01816.62
5.5.250.0080.02116.49
5.5.240.0080.03216.40
5.5.230.0040.00614.48
5.5.220.0090.00514.26
5.5.210.0070.00414.40
5.5.200.0040.01114.38
5.5.190.0080.00514.42
5.5.180.0060.00614.59
5.5.170.0080.00414.35
5.5.160.0110.00314.49
5.5.150.0050.00914.25
5.5.140.0040.00914.42
5.5.130.0060.00814.42
5.5.120.0030.00914.31
5.5.110.0060.00514.47
5.5.100.0070.00714.44
5.5.90.0060.00714.52
5.5.80.0060.00614.31
5.5.70.0040.00714.32
5.5.60.0100.00514.27
5.5.50.0050.00714.21
5.5.40.0070.00714.39
5.5.30.0040.00914.41
5.5.20.0080.00714.36
5.5.10.0040.01014.23
5.5.00.0050.01314.37
5.4.450.0230.02215.13
5.4.440.0340.02615.14
5.4.430.0350.02215.05
5.4.420.0350.03015.06
5.4.410.0280.02114.97
5.4.400.0060.02215.00
5.4.390.0290.02414.88
5.4.380.0100.01814.83
5.4.370.0110.01614.83
5.4.360.0060.02414.81
5.4.350.0070.02314.83
5.4.340.0120.02214.77
5.4.330.0050.00812.88
5.4.320.0040.01812.75
5.4.310.0030.02012.75
5.4.300.0040.01612.76
5.4.290.0040.01912.75
5.4.280.0070.01612.72
5.4.270.0040.01512.72
5.4.260.0050.01612.72
5.4.250.0050.01812.72
5.4.240.0050.01512.72
5.4.230.0070.01212.72
5.4.220.0050.01512.72
5.4.210.0040.01712.72
5.4.200.0040.01712.72
5.4.190.0030.01912.72
5.4.180.0030.01512.71
5.4.170.0060.01612.72
5.4.160.0040.01712.72
5.4.150.0040.01712.72
5.4.140.0030.02012.61
5.4.130.0040.01812.61
5.4.120.0070.01512.59
5.4.110.0060.01512.59
5.4.100.0030.01912.59
5.4.90.0050.01512.59
5.4.80.0050.01712.59
5.4.70.0030.01712.59
5.4.60.0030.01812.59
5.4.50.0070.01512.59
5.4.40.0040.01812.58
5.4.30.0070.01312.58
5.4.20.0050.01812.58
5.4.10.0040.01812.58
5.4.00.0060.01812.42
5.3.290.0030.01912.85
5.3.280.0050.01712.82
5.3.270.0060.01812.82
5.3.260.0060.01812.82
5.3.250.0060.01512.82
5.3.240.0040.01712.82
5.3.230.0050.01712.82
5.3.220.0050.01612.81
5.3.210.0080.01312.81
5.3.200.0030.01812.81
5.3.190.0060.01612.81
5.3.180.0080.01512.81
5.3.170.0100.01312.80
5.3.160.0050.01812.81
5.3.150.0070.01712.81
5.3.140.0050.02012.80
5.3.130.0070.01712.80
5.3.120.0030.01812.80
5.3.110.0030.01812.80
5.3.100.0060.01512.63
5.3.90.0060.01612.62
5.3.80.0070.01512.62
5.3.70.0050.01512.62
5.3.60.0040.01912.61
5.3.50.0060.01612.60
5.3.40.0050.01612.59
5.3.30.0050.01612.58
5.3.20.0050.01612.51
5.3.10.0030.01812.50
5.3.00.0010.02012.49
5.2.170.0050.0309.25
5.2.160.0060.0289.25
5.2.150.0060.0299.26
5.2.140.0030.0329.25
5.2.130.0020.0319.21
5.2.120.0020.0339.21
5.2.110.0050.0299.22
5.2.100.0040.0309.21
5.2.90.0040.0339.21
5.2.80.0040.0339.21
5.2.70.0030.0359.21
5.2.60.0030.0359.16
5.2.50.0040.0319.14
5.2.40.0040.0299.12
5.2.30.0070.0299.09
5.2.20.0040.0299.08
5.2.10.0040.0298.99
5.2.00.0090.0378.86
5.1.60.0060.0248.14
5.1.50.0040.0248.13
5.1.40.0050.0248.12
5.1.30.0060.0258.47
5.1.20.0050.0278.49
5.1.10.0030.0288.21
5.1.00.0050.0308.21
5.0.50.0030.0216.70
5.0.40.0040.0196.56
5.0.30.0010.0346.37
5.0.20.0030.0196.34
5.0.10.0050.0186.32
5.0.00.0020.0336.31
4.4.90.0040.0154.78
4.4.80.0030.0164.76
4.4.70.0060.0134.76
4.4.60.0030.0154.76
4.4.50.0010.0174.77
4.4.40.0030.0254.71
4.4.30.0030.0154.76
4.4.20.0040.0144.84
4.4.10.0030.0154.85
4.4.00.0020.0264.76
4.3.110.0040.0174.67
4.3.100.0020.0174.66
4.3.90.0030.0154.63
4.3.80.0030.0244.61
4.3.70.0050.0134.63
4.3.60.0040.0144.63
4.3.50.0040.0154.63
4.3.40.0040.0244.56
4.3.30.0030.0153.36
4.3.20.0020.0163.35
4.3.10.0050.0133.30
4.3.00.0070.02014.57

preferences:
41.51 ms | 401 KiB | 5 Q