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.0100.01018.55
8.3.50.0090.01022.03
8.3.40.0040.01119.01
8.3.30.0060.01219.31
8.3.20.0050.00320.38
8.3.10.0030.00623.68
8.3.00.0060.00319.81
8.2.180.0140.00716.75
8.2.170.0120.00322.96
8.2.160.0060.00820.50
8.2.150.0040.00424.18
8.2.140.0000.00924.66
8.2.130.0110.00426.16
8.2.120.0040.00420.87
8.2.110.0060.00322.40
8.2.100.0090.00318.28
8.2.90.0000.00819.33
8.2.80.0080.00018.00
8.2.70.0000.00817.88
8.2.60.0100.00018.16
8.2.50.0100.00018.07
8.2.40.0050.00318.28
8.2.30.0040.00418.40
8.2.20.0040.00418.11
8.2.10.0000.00718.19
8.2.00.0080.00018.08
8.1.280.0070.00725.92
8.1.270.0040.00423.96
8.1.260.0030.00626.35
8.1.250.0030.00528.09
8.1.240.0030.00622.21
8.1.230.0120.00019.10
8.1.220.0000.00917.76
8.1.210.0030.00618.77
8.1.200.0030.00617.38
8.1.190.0040.00417.48
8.1.180.0000.00818.10
8.1.170.0040.00418.82
8.1.160.0080.00022.04
8.1.150.0040.00418.97
8.1.140.0000.00717.64
8.1.130.0030.00317.92
8.1.120.0040.00417.75
8.1.110.0040.00417.67
8.1.100.0040.00417.64
8.1.90.0040.00417.58
8.1.80.0040.00417.52
8.1.70.0030.00317.68
8.1.60.0030.00617.85
8.1.50.0050.00317.73
8.1.40.0000.00817.70
8.1.30.0000.00917.75
8.1.20.0030.00517.79
8.1.10.0080.00017.68
8.1.00.0040.00417.71
8.0.300.0040.00418.77
8.0.290.0000.00716.88
8.0.280.0070.00018.46
8.0.270.0030.00317.22
8.0.260.0030.00317.31
8.0.250.0050.00317.15
8.0.240.0060.00317.15
8.0.230.0030.00317.23
8.0.220.0000.00717.17
8.0.210.0020.00517.21
8.0.200.0000.00617.23
8.0.190.0040.00417.11
8.0.180.0060.00317.15
8.0.170.0000.00817.09
8.0.160.0040.00417.21
8.0.150.0060.00317.08
8.0.140.0000.00817.01
8.0.130.0060.00013.63
8.0.120.0070.00317.09
8.0.110.0000.00717.22
8.0.100.0000.00717.12
8.0.90.0040.00417.20
8.0.80.0160.00017.09
8.0.70.0030.00517.14
8.0.60.0050.00217.20
8.0.50.0000.00717.13
8.0.30.0120.01117.46
8.0.20.0150.00717.43
8.0.10.0070.00017.11
8.0.00.0080.01017.07
7.4.330.0000.00515.11
7.4.320.0000.00716.80
7.4.300.0030.00316.76
7.4.290.0000.00716.82
7.4.280.0040.00716.70
7.4.270.0070.00016.79
7.4.260.0060.00316.81
7.4.250.0050.00316.79
7.4.240.0070.00016.86
7.4.230.0000.00816.88
7.4.220.0090.00916.97
7.4.210.0140.00316.91
7.4.200.0000.00716.79
7.4.160.0060.00916.71
7.4.150.0080.01217.40
7.4.140.0110.00717.86
7.4.130.0080.00916.85
7.4.120.0090.00916.89
7.4.110.0060.01117.02
7.4.100.0070.01016.74
7.4.90.0120.00616.89
7.4.80.0000.01819.39
7.4.70.0120.00416.94
7.4.60.0100.00716.95
7.4.50.0000.00816.92
7.4.40.0070.01016.86
7.4.30.0030.01216.73
7.4.00.0090.00915.25
7.3.330.0040.00313.43
7.3.320.0030.00313.55
7.3.310.0070.00016.46
7.3.300.0030.00616.55
7.3.290.0130.00716.60
7.3.280.0050.01116.58
7.3.270.0120.00617.40
7.3.260.0110.01116.74
7.3.250.0050.01416.71
7.3.240.0090.00916.75
7.3.230.0060.01216.60
7.3.210.0070.01116.65
7.3.200.0070.01319.39
7.3.190.0100.01316.71
7.3.180.0000.01616.55
7.3.170.0140.00216.81
7.3.160.0060.01216.82
7.3.120.0060.01015.01
7.2.330.0070.01016.91
7.2.320.0030.01617.07
7.2.310.0090.00816.90
7.2.300.0090.00616.91
7.2.290.0060.00916.93
7.2.60.0030.01017.25
7.2.50.0080.00317.10
7.1.200.0120.00315.96
7.1.70.0000.01117.48
7.1.60.0060.01919.70
7.1.50.0110.01116.98
7.1.00.0070.07322.46
7.0.200.0000.00716.90
7.0.140.0070.07322.07
7.0.60.0000.04319.92
7.0.50.0070.03717.93
7.0.40.0070.09020.20
7.0.30.0170.05320.21
7.0.20.0270.07320.19
7.0.10.0070.09320.27
7.0.00.0100.03720.34
5.6.280.0070.07020.91
5.6.210.0100.06320.68
5.6.200.0030.08318.22
5.6.190.0070.04320.46
5.6.180.0300.07720.55
5.6.170.0200.05320.48
5.6.160.0130.08320.71
5.6.150.0030.08018.17
5.6.140.0000.07718.15
5.6.130.0070.07718.15
5.6.120.0070.03720.91
5.6.110.0100.03721.13
5.6.100.0070.08320.94
5.6.90.0030.04321.13
5.6.80.0030.08320.39
5.5.350.0030.07020.44
5.5.340.0070.04718.08
5.5.330.0030.07320.57
5.5.320.0300.07020.48
5.5.310.0330.07020.42
5.5.300.0030.07318.07
5.5.290.0100.03317.92
5.5.280.0100.08720.68
5.5.270.0100.03320.77
5.5.260.0170.07320.89
5.5.250.0100.07720.66
5.5.240.3370.03320.27
5.4.450.0370.04319.61
5.4.440.0330.04319.56
5.4.430.0270.04319.61
5.4.420.0300.04319.38
5.4.410.0200.05319.42
5.4.400.0100.07018.84
5.4.390.0270.03719.09
5.4.380.0130.05318.54
5.4.370.0130.05718.75
5.4.360.0130.06318.74
5.4.350.0070.06018.81
5.4.340.0170.05018.72
5.4.320.0030.03812.51
5.4.310.0080.04012.51
5.4.300.0070.03612.52
5.4.290.0030.04112.51
5.4.280.0040.03712.41
5.4.270.0050.03812.41
5.4.260.0050.03812.41
5.4.250.0100.04912.41
5.4.240.0070.04312.41
5.4.230.0040.04012.40
5.4.220.0060.04712.40
5.4.210.0060.03612.40
5.4.200.0030.04112.40
5.4.190.0080.03412.40
5.4.180.0080.03512.40
5.4.170.0090.03312.41
5.4.160.0110.03212.40
5.4.150.0080.03412.40
5.4.140.0080.03512.08
5.4.130.0020.03912.07
5.4.120.0060.03512.03
5.4.110.0050.03612.02
5.4.100.0090.03312.03
5.4.90.0040.03912.02
5.4.80.0060.03612.02
5.4.70.0060.03512.02
5.4.60.0060.03512.02
5.4.50.0080.03212.02
5.4.40.0070.03512.01
5.4.30.0050.03712.00
5.4.20.0060.03612.00
5.4.10.0070.04412.01
5.4.00.0040.03811.50
5.3.290.0060.04012.80
5.3.280.0070.03612.71
5.3.270.0060.03912.73
5.3.260.0050.04212.72
5.3.250.0050.03812.72
5.3.240.0080.03612.72
5.3.230.0070.03712.71
5.3.220.0030.04012.68
5.3.210.0080.03612.68
5.3.200.0070.03612.68
5.3.190.0100.03412.68
5.3.180.0060.03712.68
5.3.170.0070.03612.67
5.3.160.0040.04112.68
5.3.150.0080.03612.67
5.3.140.0070.04112.66
5.3.130.0080.03812.66
5.3.120.0060.03912.66
5.3.110.0070.03912.66
5.3.100.0050.03912.14
5.3.90.0040.04012.12
5.3.80.0080.03512.11
5.3.70.0090.03412.11
5.3.60.0050.03712.09
5.3.50.0060.03712.03
5.3.40.0070.03612.03
5.3.30.0050.03711.99
5.3.20.0030.03811.77
5.3.10.0060.03411.75
5.3.00.0070.03411.73
5.2.170.0030.0329.26
5.2.160.0050.0299.26
5.2.150.0050.0309.26
5.2.140.0040.0329.25
5.2.130.0050.0349.21
5.2.120.0030.0299.21
5.2.110.0060.0289.21
5.2.100.0050.0289.21
5.2.90.0020.0329.21
5.2.80.0050.0309.20
5.2.70.0050.0329.21
5.2.60.0060.0299.16
5.2.50.0030.0329.13
5.2.40.0060.0279.12
5.2.30.0020.0329.09
5.2.20.0060.0289.07
5.2.10.0060.0328.99
5.2.00.0070.0278.86
5.1.60.0020.0268.14
5.1.50.0040.0258.13
5.1.40.0060.0228.12
5.1.30.0040.0268.46
5.1.20.0060.0258.48
5.1.10.0030.0288.21
5.1.00.0040.0268.22
5.0.50.0050.0276.69
5.0.40.0060.0256.55
5.0.30.0070.0376.37
5.0.20.0030.0276.33
5.0.10.0060.0256.32
5.0.00.0080.0356.31
4.4.90.0050.0204.78
4.4.80.0060.0194.76
4.4.70.0060.0184.75
4.4.60.0050.0194.75
4.4.50.0010.0174.77
4.4.40.0040.0244.71
4.4.30.0040.0154.76
4.4.20.0020.0164.85
4.4.10.0020.0164.85
4.4.00.0020.0264.76
4.3.110.0050.0144.67
4.3.100.0020.0154.66
4.3.90.0050.0124.63
4.3.80.0030.0254.61
4.3.70.0030.0144.63
4.3.60.0020.0204.63
4.3.50.0030.0154.63
4.3.40.0020.0244.55
4.3.30.0020.0163.36
4.3.20.0020.0163.33
4.3.10.0010.0173.30
4.3.00.0000.02014.60

preferences:
37.15 ms | 401 KiB | 5 Q