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.0110.01118.75
8.3.50.0110.00921.99
8.3.40.0100.01019.21
8.3.30.0140.00319.25
8.3.20.0040.00420.33
8.3.10.0050.00323.83
8.3.00.0030.00519.81
8.2.180.0110.00618.41
8.2.170.0100.01022.96
8.2.160.0130.00020.29
8.2.150.0000.00724.18
8.2.140.0080.00024.66
8.2.130.0040.00426.16
8.2.120.0040.00421.21
8.2.110.0000.00922.32
8.2.100.0040.00817.92
8.2.90.0040.00419.30
8.2.80.0050.00317.97
8.2.70.0080.00018.00
8.2.60.0050.00518.04
8.2.50.0030.00618.07
8.2.40.0020.00518.34
8.2.30.0030.00318.29
8.2.20.0040.00417.91
8.2.10.0000.00718.09
8.2.00.0030.00519.79
8.1.280.0080.00625.92
8.1.270.0080.00024.04
8.1.260.0040.00426.35
8.1.250.0000.00728.09
8.1.240.0090.00022.18
8.1.230.0040.00719.10
8.1.220.0000.00817.79
8.1.210.0030.00518.77
8.1.200.0060.00317.38
8.1.190.0040.00417.50
8.1.180.0040.00418.10
8.1.170.0080.00018.78
8.1.160.0070.00022.11
8.1.150.0000.00819.01
8.1.140.0030.00617.59
8.1.130.0000.00817.79
8.1.120.0030.00517.70
8.1.110.0040.00417.66
8.1.100.0050.00317.73
8.1.90.0000.00817.72
8.1.80.0040.00417.57
8.1.70.0070.00017.54
8.1.60.0060.00317.79
8.1.50.0040.00417.76
8.1.40.0000.00817.70
8.1.30.0060.00317.84
8.1.20.0000.00817.93
8.1.10.0040.00417.75
8.1.00.0060.00317.80
8.0.300.0040.00418.77
8.0.290.0070.00016.88
8.0.280.0040.00418.46
8.0.270.0000.00717.48
8.0.260.0000.00717.23
8.0.250.0000.00717.23
8.0.240.0040.00417.26
8.0.230.0040.00417.28
8.0.220.0000.00717.09
8.0.210.0030.00317.13
8.0.200.0030.00317.20
8.0.190.0070.00417.10
8.0.180.0000.01217.07
8.0.170.0050.00317.13
8.0.160.0030.00517.20
8.0.150.0000.00717.04
8.0.140.0000.00917.16
8.0.130.0030.00313.68
8.0.120.0000.00717.05
8.0.110.0040.00417.07
8.0.100.0000.00717.18
8.0.90.0000.00717.19
8.0.80.0070.01017.23
8.0.70.0000.00717.13
8.0.60.0040.00416.99
8.0.50.0000.00817.07
8.0.30.0120.01117.38
8.0.20.0050.01317.40
8.0.10.0040.00417.15
8.0.00.0060.01516.98
7.4.330.0020.00215.22
7.4.320.0070.00016.69
7.4.300.0000.00616.64
7.4.290.0070.00016.73
7.4.280.0030.00616.90
7.4.270.0000.00816.88
7.4.260.0040.00716.80
7.4.250.0020.00516.73
7.4.240.0050.00316.88
7.4.230.0070.00016.87
7.4.220.0110.00716.73
7.4.210.0070.01116.98
7.4.200.0050.00316.78
7.4.160.0110.00416.94
7.4.150.0150.00417.40
7.4.140.0080.00917.86
7.4.130.0120.00816.79
7.4.120.0060.01116.74
7.4.110.0120.00616.85
7.4.100.0100.00716.81
7.4.90.0030.01316.80
7.4.80.0180.00319.39
7.4.70.0120.01216.70
7.4.60.0110.00616.84
7.4.50.0000.00816.74
7.4.40.0090.00916.73
7.4.30.0130.00316.81
7.4.00.0040.01115.21
7.3.330.0020.00513.72
7.3.320.0030.00313.40
7.3.310.0030.00316.69
7.3.300.0080.00016.67
7.3.290.0070.01116.65
7.3.280.0080.00916.68
7.3.270.0110.01117.40
7.3.260.0150.00316.89
7.3.250.0070.01016.80
7.3.240.0130.00716.72
7.3.230.0090.00616.82
7.3.210.0130.00516.61
7.3.200.0190.00519.39
7.3.190.0110.00616.64
7.3.180.0080.00816.81
7.3.170.0100.00716.65
7.3.160.0140.00316.71
7.3.120.0040.00714.94
7.2.330.0100.00716.95
7.2.320.0140.00417.09
7.2.310.0140.00316.94
7.2.300.0060.01616.95
7.2.290.0110.00516.95
7.2.60.0100.00617.12
7.2.00.0100.01319.68
7.1.200.0030.00615.98
7.1.100.0030.00917.93
7.1.70.0000.01117.47
7.1.60.0070.01719.70
7.1.50.0000.01616.98
7.1.00.0100.07022.45
7.0.200.0000.00916.91
7.0.140.0000.07722.01
7.0.60.0100.07019.84
7.0.50.0070.08017.78
7.0.40.0100.04320.23
7.0.30.0300.08020.24
7.0.20.0200.04720.22
7.0.10.0100.08720.24
7.0.00.0100.08320.13
5.6.280.0030.07320.98
5.6.210.0070.06720.57
5.6.200.0070.06018.20
5.6.190.0070.08020.61
5.6.180.0270.08320.61
5.6.170.0300.07320.55
5.6.160.0070.08720.46
5.6.150.0030.04018.16
5.6.140.0130.07318.23
5.6.130.0070.03718.18
5.6.120.0070.05021.01
5.6.110.0100.07721.16
5.6.100.0030.06321.12
5.6.90.0070.05021.14
5.6.80.0030.07320.42
5.5.350.0000.08320.50
5.5.340.0030.08718.07
5.5.330.0170.07320.35
5.5.320.0270.08020.51
5.5.310.0270.03020.25
5.5.300.0030.05017.98
5.5.290.0170.06717.95
5.5.280.0070.08320.91
5.5.270.0100.06320.73
5.5.260.0100.07320.88
5.5.250.0130.05320.69
5.5.240.4130.04020.24
5.4.450.0330.04019.61
5.4.440.0400.05019.38
5.4.430.0200.05319.38
5.4.420.0370.05019.16
5.4.410.0370.04019.57
5.4.400.0570.04019.22
5.4.390.0130.05019.08
5.4.380.0100.07018.57
5.4.370.0100.05718.51
5.4.360.0130.05318.75
5.4.350.0100.05718.66
5.4.340.0230.06318.75
5.4.320.0080.03612.52
5.4.310.0050.04112.51
5.4.300.0060.05212.52
5.4.290.0090.05112.51
5.4.280.0030.03912.41
5.4.270.0070.03712.41
5.4.260.0080.05112.41
5.4.250.0120.04712.41
5.4.240.0050.03712.41
5.4.230.0070.03612.41
5.4.220.0100.03312.40
5.4.210.0060.03612.40
5.4.200.0100.03512.40
5.4.190.0080.03512.40
5.4.180.0060.03712.40
5.4.170.0060.03812.41
5.4.160.0040.03812.40
5.4.150.0060.03612.40
5.4.140.0070.04012.08
5.4.130.0100.03312.07
5.4.120.0060.05112.03
5.4.110.0090.04812.03
5.4.100.0060.03812.03
5.4.90.0060.03712.02
5.4.80.0040.03912.03
5.4.70.0060.03412.02
5.4.60.0040.03612.02
5.4.50.0080.03312.02
5.4.40.0050.03612.01
5.4.30.0040.03712.00
5.4.20.0070.03512.00
5.4.10.0050.03512.00
5.4.00.0070.03511.50
5.3.290.0070.03812.80
5.3.280.0060.04012.71
5.3.270.0060.04112.73
5.3.260.0060.03912.72
5.3.250.0070.03612.72
5.3.240.0080.03512.72
5.3.230.0060.03812.71
5.3.220.0040.03912.68
5.3.210.0050.04112.68
5.3.200.0070.03612.68
5.3.190.0070.03812.68
5.3.180.0060.03712.68
5.3.170.0050.03812.67
5.3.160.0030.03912.68
5.3.150.0090.03412.68
5.3.140.0050.03812.66
5.3.130.0080.03912.66
5.3.120.0060.04012.66
5.3.110.0070.03812.66
5.3.100.0080.03612.13
5.3.90.0130.03612.12
5.3.80.0100.03512.11
5.3.70.0060.04312.11
5.3.60.0040.04012.09
5.3.50.0090.03812.03
5.3.40.0080.04012.03
5.3.30.0060.03612.00
5.3.20.0020.03911.77
5.3.10.0080.03311.75
5.3.00.0050.03711.73
5.2.170.0060.0409.25
5.2.160.0050.0319.25
5.2.150.0070.0409.26
5.2.140.0060.0419.25
5.2.130.0090.0369.21
5.2.120.0070.0399.21
5.2.110.0080.0299.21
5.2.100.0050.0339.21
5.2.90.0080.0279.21
5.2.80.0010.0409.20
5.2.70.0090.0309.20
5.2.60.0040.0309.17
5.2.50.0060.0299.13
5.2.40.0080.0319.12
5.2.30.0050.0289.08
5.2.20.0040.0309.07
5.2.10.0100.0348.99
5.2.00.0060.0288.86
5.1.60.0050.0238.14
5.1.50.0020.0318.13
5.1.40.0040.0248.11
5.1.30.0040.0268.46
5.1.20.0060.0248.49
5.1.10.0040.0318.21
5.1.00.0060.0238.21
5.0.50.0040.0206.69
5.0.40.0020.0216.55
5.0.30.0040.0316.37
5.0.20.0030.0206.33
5.0.10.0030.0216.32
5.0.00.0020.0346.32
4.4.90.0030.0154.78
4.4.80.0060.0134.76
4.4.70.0040.0154.76
4.4.60.0030.0154.76
4.4.50.0040.0154.77
4.4.40.0030.0244.71
4.4.30.0040.0144.75
4.4.20.0020.0164.84
4.4.10.0050.0134.85
4.4.00.0020.0264.76
4.3.110.0030.0154.67
4.3.100.0020.0164.67
4.3.90.0040.0144.63
4.3.80.0040.0244.61
4.3.70.0020.0154.63
4.3.60.0020.0154.63
4.3.50.0040.0144.63
4.3.40.0010.0264.55
4.3.30.0020.0173.36
4.3.20.0020.0163.34
4.3.10.0040.0143.30
4.3.00.0100.01314.59

preferences:
38.77 ms | 401 KiB | 5 Q