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++) { $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.0200.00018.68
8.3.50.0100.00318.39
8.3.40.0090.00619.06
8.3.30.0110.00619.09
8.3.20.0060.00320.30
8.3.10.0030.00523.48
8.3.00.0080.00019.41
8.2.180.0130.00716.73
8.2.170.0000.01422.96
8.2.160.0040.01420.40
8.2.150.0050.00324.18
8.2.140.0000.00724.66
8.2.130.0100.00326.16
8.2.120.0070.00021.03
8.2.110.0000.00922.34
8.2.100.0040.00819.82
8.2.90.0040.00419.22
8.2.80.0080.00017.97
8.2.70.0030.00617.88
8.2.60.0000.01017.80
8.2.50.0090.00018.07
8.2.40.0080.00018.03
8.2.30.0050.00318.30
8.2.20.0050.00317.93
8.2.10.0080.00018.13
8.2.00.0080.00018.03
8.1.280.0000.01425.92
8.1.270.0040.00423.80
8.1.260.0030.00626.35
8.1.250.0040.00428.09
8.1.240.0030.00622.20
8.1.230.0040.00819.05
8.1.220.0040.00417.74
8.1.210.0040.00418.77
8.1.200.0060.00317.60
8.1.190.0030.00517.36
8.1.180.0050.00318.10
8.1.170.0060.00318.63
8.1.160.0030.00521.92
8.1.150.0000.00718.87
8.1.140.0040.00417.61
8.1.130.0030.00317.79
8.1.120.0020.00517.54
8.1.110.0040.00417.52
8.1.100.0040.00417.52
8.1.90.0000.00717.47
8.1.80.0000.00717.59
8.1.70.0030.00317.45
8.1.60.0040.00417.72
8.1.50.0030.00617.67
8.1.40.0000.00817.73
8.1.30.0000.00817.66
8.1.20.0060.00317.82
8.1.10.0040.00417.74
8.1.00.0030.00517.58
8.0.300.0050.00318.77
8.0.290.0040.00416.88
8.0.280.0030.00318.36
8.0.270.0030.00317.18
8.0.260.0030.00317.25
8.0.250.0070.00017.20
8.0.240.0000.00717.06
8.0.230.0000.00717.00
8.0.220.0000.00717.08
8.0.210.0040.00416.96
8.0.200.0030.00317.09
8.0.190.0040.00517.13
8.0.180.0030.00617.05
8.0.170.0000.00817.08
8.0.160.0000.00817.04
8.0.150.0070.00016.98
8.0.140.0060.00317.06
8.0.130.0060.00013.48
8.0.120.0000.00917.04
8.0.110.0040.00417.00
8.0.100.0000.00716.89
8.0.90.0000.00716.94
8.0.80.0160.00717.05
8.0.70.0000.00816.87
8.0.60.0000.00717.09
8.0.50.0050.00317.18
8.0.30.0110.00917.29
8.0.20.0090.01017.40
8.0.10.0000.00817.13
8.0.00.0130.00516.99
7.4.330.0020.00215.18
7.4.320.0050.00216.79
7.4.300.0030.00316.72
7.4.290.0030.00316.79
7.4.280.0110.00016.91
7.4.270.0070.00016.89
7.4.260.0030.00516.71
7.4.250.0050.00216.79
7.4.240.0020.00616.78
7.4.230.0000.00716.88
7.4.220.0110.00717.00
7.4.210.0090.00617.00
7.4.200.0030.00517.00
7.4.160.0080.00816.90
7.4.150.0140.00717.40
7.4.140.0130.00517.86
7.4.130.0060.01216.70
7.4.120.0070.01116.85
7.4.110.0120.00616.96
7.4.100.0100.00716.83
7.4.90.0040.01416.86
7.4.80.0070.01319.39
7.4.70.0080.00816.85
7.4.60.0130.00316.62
7.4.50.0030.00616.89
7.4.40.0090.00616.85
7.4.30.0090.00616.69
7.4.00.0030.01415.27
7.3.330.0000.00613.73
7.3.320.0020.00213.68
7.3.310.0030.00316.73
7.3.300.0020.00516.57
7.3.290.0080.00816.64
7.3.280.0110.00916.64
7.3.270.0080.00817.40
7.3.260.0120.01216.70
7.3.250.0110.00916.84
7.3.240.0130.01016.73
7.3.230.0100.00716.66
7.3.210.0060.01116.67
7.3.200.0110.01119.39
7.3.190.0000.01816.53
7.3.180.0070.01016.70
7.3.170.0090.01216.75
7.3.160.0130.00316.78
7.3.120.0040.01315.24
7.3.110.0000.01315.18
7.3.100.0060.00615.20
7.3.90.0100.00715.19
7.3.80.0060.00914.69
7.3.70.0070.01014.93
7.3.60.0120.00315.10
7.3.50.0090.00615.00
7.3.40.0000.01415.22
7.3.30.0070.01015.09
7.3.20.0060.00916.98
7.3.10.0090.00516.84
7.3.00.0080.00616.85
7.2.330.0070.01116.84
7.2.320.0160.00216.77
7.2.310.0100.00616.98
7.2.300.0100.00717.03
7.2.290.0100.00716.91
7.2.250.0070.01315.40
7.2.240.0100.00715.26
7.2.230.0070.01015.32
7.2.220.0070.00715.08
7.2.210.0070.00715.14
7.2.200.0040.01115.18
7.2.190.0040.00815.13
7.2.180.0030.01415.27
7.2.170.0070.00715.19
7.2.130.0070.00716.81
7.2.120.0100.00516.95
7.2.110.0070.01016.84
7.2.100.0080.00717.15
7.2.90.0120.00217.03
7.2.80.0050.01216.80
7.2.70.0090.01217.00
7.2.60.0080.00717.00
7.2.50.0100.00717.16
7.2.40.0100.00917.17
7.2.30.0070.00717.12
7.2.20.0050.00717.01
7.2.10.0120.00616.73
7.2.00.0090.00817.83
7.1.330.0040.01116.21
7.1.320.0120.00016.00
7.1.310.0060.00916.07
7.1.300.0090.00615.88
7.1.290.0060.00615.95
7.1.280.0040.01115.96
7.1.270.0100.00715.84
7.1.260.0100.00715.74
7.1.250.0090.00515.94
7.1.200.0090.00315.77
7.1.100.0030.00918.17
7.1.70.0030.00517.49
7.1.60.0120.01219.70
7.1.50.0090.01617.18
7.1.00.0000.08022.38
7.0.200.0050.00216.91
7.0.140.0070.06722.00
7.0.110.0070.07320.08
7.0.100.0170.07020.12
7.0.90.0070.06319.98
7.0.80.0270.05719.93
7.0.70.0500.07719.86
7.0.60.0100.08020.05
7.0.50.0470.05719.88
7.0.40.0230.04019.75
7.0.30.0070.07719.78
7.0.20.0130.06019.77
7.0.10.0100.07319.85
7.0.00.0070.07319.72
5.6.260.0170.07320.70
5.6.250.0070.06320.75
5.6.240.0200.07020.73
5.6.230.0030.04720.87
5.6.220.0130.07320.66
5.6.210.0100.05720.72
5.6.200.0170.07720.72
5.6.190.0130.07020.69
5.6.180.0100.07320.60
5.6.170.0070.07720.66
5.6.160.0030.05320.56
5.6.150.0100.06020.63
5.6.140.0070.04720.71
5.6.130.0070.04020.56
5.6.120.0130.07320.69
5.6.110.0130.07020.46
5.6.100.0030.08020.70
5.6.90.0170.06720.69
5.6.80.0000.04320.10
5.6.70.0000.09019.94
5.6.60.0100.07320.23
5.6.50.0070.05320.06
5.6.40.0070.06319.98
5.6.30.0100.07720.01
5.6.20.0070.08720.02
5.6.10.0070.07020.22
5.6.00.0070.04319.98
5.5.380.0030.08317.69
5.5.370.0100.06317.64
5.5.360.0030.05317.56
5.5.350.0030.08317.64
5.5.340.0100.08017.95
5.5.330.0000.05018.05
5.5.320.0000.07318.09
5.5.310.0100.07318.12
5.5.300.0130.06718.10
5.5.290.0030.05017.92
5.5.280.0230.02717.95
5.5.270.0100.08018.05
5.5.260.0100.06018.12
5.5.250.0130.03718.04
5.5.240.0130.06717.62
5.5.230.0030.05017.48
5.5.220.0070.04317.34
5.5.210.0030.08317.48
5.5.200.0100.07017.28
5.5.190.0170.06317.48
5.5.180.0170.05717.59
5.5.160.0100.03317.30
5.5.150.0070.03017.48
5.5.140.0100.03317.18
5.5.130.0030.04317.49
5.5.120.0030.08017.47
5.5.110.0070.08017.58
5.5.100.0000.07017.36
5.5.90.0070.05317.20
5.5.80.0100.03317.37
5.5.70.0100.07317.15
5.5.60.0070.04717.36
5.5.50.0100.07317.15
5.5.40.0030.08017.31
5.5.30.0100.05717.19
5.5.20.0030.08317.34
5.5.10.0070.07317.49
5.5.00.0030.07717.19
5.4.450.0100.08019.56
5.4.440.0030.06019.68
5.4.430.0100.06719.37
5.4.420.0000.07319.38
5.4.410.0100.06719.21
5.4.400.0070.04319.23
5.4.390.0000.07019.09
5.4.380.0000.07719.05
5.4.370.0000.08719.15
5.4.360.0070.07719.04
5.4.350.0030.08319.16
5.4.340.0100.07719.14
5.4.320.0000.07319.15
5.4.310.0000.07019.27
5.4.300.0030.04719.14
5.4.290.0070.03719.09
5.4.280.0030.06719.04
5.4.270.0070.07319.23
5.4.260.0100.05319.14
5.4.250.0070.03719.06
5.4.240.0070.08719.09
5.4.230.0130.06719.22
5.4.220.0100.06019.09
5.4.210.0070.07719.14
5.4.200.0070.07319.21
5.4.190.0100.04019.14
5.4.180.0000.04019.21
5.4.170.0100.06719.23
5.4.160.0100.06719.05
5.4.150.0000.07019.13
5.4.140.0000.04716.53
5.4.130.0000.04716.50
5.4.120.0000.08016.62
5.4.110.0100.07016.49
5.4.100.0030.07716.47
5.4.90.0000.04316.57
5.4.80.0030.07316.52
5.4.70.0100.05716.49
5.4.60.0100.07016.51
5.4.50.0070.03716.30
5.4.40.0030.06016.62
5.4.30.0100.06316.62
5.4.20.0170.06716.63
5.4.10.0070.05316.57
5.4.00.0070.03315.84
5.3.290.0100.07314.75
5.3.280.0030.05014.73
5.3.270.0000.08314.71
5.3.260.0070.07314.62
5.3.250.0030.06314.61
5.3.240.0070.07714.82
5.3.230.0100.07014.81
5.3.220.0100.05714.60
5.3.210.0030.05714.72
5.3.200.0170.06014.57
5.3.190.0070.05014.72
5.3.180.0000.08014.71
5.3.170.0130.06314.53
5.3.160.0000.04014.72
5.3.150.0100.07714.80
5.3.140.0030.05014.78
5.3.130.0070.04714.65
5.3.120.0070.06014.68
5.3.110.0030.04714.70
5.3.100.0030.04714.29
5.3.90.0030.07014.04
5.3.80.0100.06013.99
5.3.70.0100.07314.11
5.3.60.0070.04714.01
5.3.50.0030.08013.96
5.3.40.0170.06713.98
5.3.30.0070.06014.00
5.3.20.0100.06013.69
5.3.10.0070.03313.75
5.3.00.0070.04013.65
5.2.170.0100.05012.05
5.2.160.0030.04012.05
5.2.150.0100.03012.05
5.2.140.0070.05312.05
5.2.130.0070.06012.05
5.2.120.0070.03012.05
5.2.110.0030.03012.05
5.2.100.0100.02012.05
5.2.90.0030.02712.05
5.2.80.0000.03012.05
5.2.70.0000.03012.05
5.2.60.0000.02712.05
5.2.50.0000.02712.05
5.2.40.0030.02312.05
5.2.30.0100.02012.05
5.2.20.0000.04012.05
5.2.10.0000.02312.05
5.2.00.0070.02712.05
5.1.60.0000.02712.05
5.1.50.0000.02312.05
5.1.40.0030.02312.05
5.1.30.0030.02312.05
5.1.20.0030.02312.05
5.1.10.0000.02712.05
5.1.00.0000.02712.05
5.0.50.0000.02712.05
5.0.40.0000.02012.05
5.0.30.0030.03012.05
5.0.20.0000.01712.05
5.0.10.0000.02012.05
5.0.00.0000.02712.05
4.4.90.0000.01712.05
4.4.80.0000.01312.05
4.4.70.0000.01312.05
4.4.60.0000.01312.05
4.4.50.0030.01312.05
4.4.40.0030.02312.05
4.4.30.0000.01312.05
4.4.20.0030.01312.05
4.4.10.0030.01012.05
4.4.00.0030.02312.05
4.3.110.0030.01312.05
4.3.100.0030.01712.05
4.3.90.0000.01312.05
4.3.80.0000.02312.05
4.3.70.0000.01312.05
4.3.60.0000.01712.05
4.3.50.0000.02312.05
4.3.40.0000.02312.05
4.3.30.0000.01712.05
4.3.20.0000.01312.05
4.3.10.0000.01312.05
4.3.00.0000.01312.05

preferences:
61.75 ms | 400 KiB | 5 Q