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.0130.00618.68
8.3.50.0090.01022.11
8.3.40.0110.00419.23
8.3.30.0110.00719.21
8.3.20.0070.00320.41
8.3.10.0000.00823.75
8.3.00.0060.00319.66
8.2.180.0150.00316.75
8.2.170.0030.01022.96
8.2.160.0070.00722.28
8.2.150.0030.00624.18
8.2.140.0040.01124.66
8.2.130.0040.00426.16
8.2.120.0080.00021.09
8.2.110.0090.00022.38
8.2.100.0090.00318.09
8.2.90.0090.00019.34
8.2.80.0040.00418.13
8.2.70.0050.00318.00
8.2.60.0080.00418.05
8.2.50.0030.00618.13
8.2.40.0000.00818.15
8.2.30.0000.00718.37
8.2.20.0040.00418.17
8.2.10.0040.00418.22
8.2.00.0040.00418.01
8.1.280.0060.00925.92
8.1.270.0060.00323.96
8.1.260.0080.00026.35
8.1.250.0000.00828.09
8.1.240.0100.00320.74
8.1.230.0030.00920.88
8.1.220.0000.00817.79
8.1.210.0050.00318.77
8.1.200.0030.00617.61
8.1.190.0050.00317.35
8.1.180.0040.00418.10
8.1.170.0050.00318.72
8.1.160.0030.00522.11
8.1.150.0070.00018.99
8.1.140.0030.00617.68
8.1.130.0000.00817.94
8.1.120.0040.00417.65
8.1.110.0040.00417.73
8.1.100.0000.00817.72
8.1.90.0000.00717.67
8.1.80.0080.00017.63
8.1.70.0000.00717.62
8.1.60.0030.00617.71
8.1.50.0030.00517.74
8.1.40.0040.00417.73
8.1.30.0060.00317.84
8.1.20.0050.00317.79
8.1.10.0050.00317.82
8.1.00.0000.00817.75
8.0.300.0040.00418.77
8.0.290.0050.00217.00
8.0.280.0070.00018.45
8.0.270.0000.00717.35
8.0.260.0000.00617.38
8.0.250.0030.00517.22
8.0.240.0030.00317.14
8.0.230.0030.00617.24
8.0.220.0040.00417.19
8.0.210.0030.00317.20
8.0.200.0030.00317.26
8.0.190.0040.00417.27
8.0.180.0000.00917.13
8.0.170.0040.00417.17
8.0.160.0070.00017.07
8.0.150.0070.00017.07
8.0.140.0000.01017.12
8.0.130.0000.00613.64
8.0.120.0040.00417.07
8.0.110.0000.00817.07
8.0.100.0080.00017.00
8.0.90.0000.00717.05
8.0.80.0100.01317.10
8.0.70.0000.00817.07
8.0.60.0040.00417.24
8.0.50.0040.00417.21
8.0.30.0100.01017.50
8.0.20.0110.00817.40
8.0.10.0040.00417.39
8.0.00.0090.00917.22
7.4.330.0050.00015.05
7.4.320.0030.00316.88
7.4.300.0030.00316.84
7.4.290.0040.00416.78
7.4.280.0000.01015.95
7.4.270.0000.00816.90
7.4.260.0100.00016.70
7.4.250.0000.00716.87
7.4.240.0020.00616.85
7.4.230.0030.00316.91
7.4.220.0150.00316.84
7.4.210.0100.00316.81
7.4.200.0050.00316.76
7.4.160.0090.00916.91
7.4.150.0120.00617.40
7.4.140.0040.01217.86
7.4.130.0130.00716.77
7.4.120.0070.01116.72
7.4.110.0090.00916.79
7.4.100.0070.01116.75
7.4.90.0110.00816.75
7.4.80.0100.01319.39
7.4.70.0160.00016.86
7.4.60.0100.00716.81
7.4.50.0000.00516.79
7.4.40.0090.00616.80
7.4.30.0120.00316.86
7.4.00.0050.01215.22
7.3.330.0040.00413.65
7.3.320.0050.00013.45
7.3.310.0030.00316.66
7.3.300.0030.00616.71
7.3.290.0100.01016.74
7.3.280.0070.00916.65
7.3.270.0090.01217.40
7.3.260.0110.00716.83
7.3.250.0090.01216.67
7.3.240.0170.00016.95
7.3.230.0110.00716.69
7.3.210.0120.01216.68
7.3.200.0100.00719.39
7.3.190.0140.01116.66
7.3.180.0120.00916.88
7.3.170.0030.01216.80
7.3.160.0150.00616.68
7.3.120.0090.00915.20
7.3.110.0070.00915.13
7.3.100.0060.00615.15
7.3.90.0040.00915.20
7.3.80.0030.01115.03
7.3.70.0060.00915.08
7.3.60.0060.00815.11
7.3.50.0050.00914.98
7.3.40.0070.00914.95
7.3.30.0080.00515.11
7.3.20.0080.00516.75
7.3.10.0060.00716.81
7.3.00.0100.00517.02
7.2.330.0100.00717.02
7.2.320.0030.01817.07
7.2.310.0100.00616.90
7.2.300.0130.00316.75
7.2.290.0080.00817.04
7.2.250.0080.01015.13
7.2.240.0090.01015.23
7.2.230.0090.00915.35
7.2.220.0080.00614.92
7.2.210.0060.01015.33
7.2.200.0080.00815.25
7.2.190.0030.01015.26
7.2.180.0070.00615.38
7.2.170.0030.01415.13
7.2.60.0120.00316.96
7.2.00.0060.01119.62
7.1.330.0070.00916.13
7.1.320.0050.00615.97
7.1.310.0060.00815.87
7.1.300.0060.00615.78
7.1.290.0050.01216.07
7.1.280.0060.01016.03
7.1.270.0070.00616.02
7.1.260.0100.00515.96
7.1.200.0040.00815.96
7.1.100.0090.00318.46
7.1.70.0060.00317.52
7.1.60.0130.00919.70
7.1.50.0120.00917.05
7.1.00.0130.06722.41
7.0.200.0000.00816.83
7.0.140.0000.07322.07
7.0.60.0130.07319.94
7.0.50.0070.05017.89
7.0.40.0200.07320.38
7.0.30.0130.04720.35
7.0.20.0100.04720.29
7.0.10.0030.05320.35
7.0.00.0070.08320.10
5.6.210.0170.05020.74
5.6.200.0100.08318.24
5.6.190.0100.07020.61
5.6.180.0070.07320.51
5.6.170.0230.07020.56
5.6.160.0100.08720.55
5.6.150.0030.07718.17
5.6.140.0070.07718.15
5.6.130.0230.06718.18
5.6.120.0100.07320.99
5.6.110.0130.07721.14
5.6.100.0070.08721.02
5.6.90.0200.06021.08
5.6.80.0170.07020.52
5.5.350.0070.03720.54
5.5.340.0100.08017.98
5.5.330.0070.05720.37
5.5.320.0230.07720.42
5.5.310.0330.04020.40
5.5.300.0100.07718.01
5.5.290.0100.05318.04
5.5.280.0070.09020.91
5.5.270.0170.07320.85
5.5.260.0130.07720.90
5.5.250.0070.07320.59
5.5.240.0370.06720.34
5.4.450.2070.04019.62
5.4.440.2100.04019.41
5.4.430.2200.03019.20
5.4.420.2270.03719.30
5.4.410.2170.03319.18
5.4.400.2030.04319.23
5.4.390.2400.03718.84
5.4.380.2100.03719.09
5.4.370.2430.04719.05
5.4.360.2100.03719.24
5.4.350.2300.04018.98
5.4.340.2400.04318.95
5.4.320.2300.03719.08
5.4.310.2430.04019.05
5.4.300.2430.04019.25
5.4.290.2300.04319.27
5.4.280.2400.04718.98
5.4.270.2200.04319.37
5.4.260.2370.04018.87
5.4.250.2070.03319.37
5.4.240.2400.03719.17
5.4.230.2000.04018.83
5.4.220.2400.03719.27
5.4.210.2030.03719.07
5.4.200.2230.04719.08
5.4.190.2370.03718.86
5.4.180.2330.03719.07
5.4.170.2270.05019.36
5.4.160.2300.04019.07
5.4.150.2230.04319.21
5.4.140.2400.03316.37
5.4.130.2270.04316.49
5.4.120.2170.03716.55
5.4.110.2170.04016.63
5.4.100.2070.03316.30
5.4.90.2430.02716.46
5.4.80.2000.04016.64
5.4.70.2330.03016.45
5.4.60.2170.03016.53
5.4.50.1870.04016.47
5.4.40.1770.03716.43
5.4.30.2130.03016.44
5.4.20.2070.04016.42
5.4.10.2100.03316.51
5.4.00.1970.03315.95
5.3.290.2430.05014.68
5.3.280.2470.04314.58
5.3.270.2400.04014.61
5.3.260.2100.04014.76
5.3.250.2300.03014.76
5.3.240.1700.04314.66
5.3.230.1870.03714.72
5.3.220.1930.03714.57
5.3.210.2070.04014.59
5.3.200.2100.04014.61
5.3.190.1870.04314.63
5.3.180.1970.03714.71
5.3.170.2170.03314.72
5.3.160.2170.03714.55
5.3.150.2030.03714.69
5.3.140.2030.04014.52
5.3.130.2200.04014.52
5.3.120.2070.03314.78
5.3.110.1830.04014.63
5.3.100.2200.03314.20
5.3.90.2430.03714.08
5.3.80.2470.03314.14
5.3.70.2370.03314.26
5.3.60.2100.03313.92
5.3.50.2200.02714.04
5.3.40.2270.03713.97
5.3.30.2400.04013.97
5.3.20.2330.04313.82
5.3.10.2300.03313.79
5.3.00.2370.03313.57
5.2.170.1930.03711.20
5.2.160.2000.03011.30
5.2.150.1900.04011.21
5.2.140.2070.02311.20
5.2.130.1730.03011.15
5.2.120.1730.02311.27
5.2.110.1970.03011.30
5.2.100.1930.03711.27
5.2.90.1830.02711.16
5.2.80.1630.03711.23
5.2.70.1930.03711.30
5.2.60.2000.03011.16
5.2.50.2000.03311.08
5.2.40.1600.02711.14
5.2.30.1630.03011.20
5.2.20.1630.03311.15
5.2.10.1430.03710.97
5.2.00.1370.02710.88
5.1.60.1670.03010.05
5.1.50.1330.02710.20
5.1.40.1330.02310.04
5.1.30.1530.03310.40
5.1.20.1600.02310.69
5.1.10.1630.03010.21
5.1.00.1570.03010.13
5.0.50.0930.0278.71
5.0.40.0870.0338.46
5.0.30.0830.0438.29
5.0.20.0870.0238.26
5.0.10.0670.0238.29
5.0.00.0670.0308.29
4.4.90.0800.0177.35
4.4.80.0730.0137.35
4.4.70.0670.0177.35
4.4.60.0670.0177.35
4.4.50.0770.0177.35
4.4.40.0770.0277.35
4.4.30.0870.0237.35
4.4.20.0770.0207.36
4.4.10.0900.0207.36
4.4.00.0730.0307.36
4.3.110.0830.0237.37
4.3.100.0870.0237.38
4.3.90.0770.0137.39
4.3.80.0730.0207.39
4.3.70.0930.0207.39
4.3.60.0830.0177.42
4.3.50.0870.0237.43
4.3.40.0900.0337.43
4.3.30.0430.0207.43
4.3.20.0530.0207.43
4.3.10.0430.0307.43
4.3.00.0370.0177.43

preferences:
41.63 ms | 401 KiB | 5 Q