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); $c = base_convert((round(min(max(0, floatval($c . ($c * $lum))),255))), 10, 16); $rgb .= substr('00' . $c, strlen($c)); } 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.0040.01118.55
8.3.50.0110.00822.02
8.3.40.0070.00718.92
8.3.30.0080.00619.09
8.3.20.0000.00820.25
8.3.10.0090.00923.71
8.3.00.0030.00619.56
8.2.180.0160.00316.75
8.2.170.0060.01522.96
8.2.160.0110.00320.57
8.2.150.0050.00324.18
8.2.140.0000.00824.66
8.2.130.0040.00426.16
8.2.120.0080.00021.00
8.2.110.0060.00322.33
8.2.100.0060.00618.16
8.2.90.0060.00319.22
8.2.80.0050.00317.97
8.2.70.0060.00317.88
8.2.60.0080.00317.93
8.2.50.0080.00018.07
8.2.40.0040.00418.16
8.2.30.0070.00018.36
8.2.20.0030.00517.87
8.2.10.0070.00018.04
8.2.00.0000.00817.86
8.1.280.0040.01125.92
8.1.270.0040.00423.91
8.1.260.0080.00026.35
8.1.250.0000.00728.09
8.1.240.0000.00921.92
8.1.230.0080.00319.15
8.1.220.0000.00817.74
8.1.210.0040.00418.77
8.1.200.0060.00317.47
8.1.190.0080.00017.38
8.1.180.0040.00418.10
8.1.170.0000.00818.68
8.1.160.0000.00722.06
8.1.150.0030.00518.85
8.1.140.0000.00917.48
8.1.130.0030.00317.88
8.1.120.0040.00417.57
8.1.110.0040.00417.48
8.1.100.0000.00817.44
8.1.90.0040.00417.47
8.1.80.0000.00717.58
8.1.70.0030.00317.52
8.1.60.0030.00617.77
8.1.50.0030.00517.68
8.1.40.0000.00717.61
8.1.30.0000.00817.90
8.1.20.0040.00417.78
8.1.10.0040.00417.60
8.1.00.0040.00417.65
8.0.300.0000.00718.77
8.0.290.0000.00817.00
8.0.280.0000.00718.42
8.0.270.0030.00317.23
8.0.260.0030.00317.14
8.0.250.0000.00717.09
8.0.240.0040.00417.00
8.0.230.0000.00717.11
8.0.220.0000.00717.12
8.0.210.0070.00016.98
8.0.200.0030.00317.09
8.0.190.0070.00317.11
8.0.180.0040.00717.08
8.0.170.0070.00016.98
8.0.160.0000.00717.06
8.0.150.0030.00316.98
8.0.140.0000.00917.00
8.0.130.0000.00513.48
8.0.120.0000.00716.87
8.0.110.0000.00717.03
8.0.100.0000.00717.01
8.0.90.0070.00016.93
8.0.80.0130.00317.05
8.0.70.0000.00717.06
8.0.60.0000.00717.00
8.0.50.0070.00016.91
8.0.30.0060.01317.15
8.0.20.0110.00917.40
8.0.10.0040.00417.14
8.0.00.0140.00816.96
7.4.330.0000.00515.05
7.4.320.0000.00716.88
7.4.300.0030.00316.77
7.4.290.0070.00016.81
7.4.280.0080.00016.93
7.4.270.0080.00016.81
7.4.260.0060.00616.77
7.4.250.0000.00716.81
7.4.240.0040.00416.89
7.4.230.0000.00716.91
7.4.220.0030.01516.80
7.4.210.0040.01116.92
7.4.200.0050.00316.99
7.4.160.0030.01316.75
7.4.150.0110.00717.40
7.4.140.0080.01017.86
7.4.130.0060.01116.92
7.4.120.0130.00716.79
7.4.110.0180.00416.79
7.4.100.0140.00416.80
7.4.90.0090.00916.93
7.4.80.0090.00919.39
7.4.70.0100.01016.88
7.4.60.0040.01216.80
7.4.50.0050.00016.96
7.4.40.0070.01016.90
7.4.30.0070.01016.81
7.4.00.0040.01115.38
7.3.330.0000.00713.66
7.3.320.0030.00313.44
7.3.310.0030.00316.66
7.3.300.0040.00416.60
7.3.290.0090.00916.66
7.3.280.0080.01116.65
7.3.270.0060.01217.40
7.3.260.0080.01216.82
7.3.250.0070.01416.87
7.3.240.0120.00916.78
7.3.230.0090.00916.83
7.3.210.0110.00716.67
7.3.200.0090.01319.39
7.3.190.0110.01116.97
7.3.180.0090.01216.70
7.3.170.0050.01016.74
7.3.160.0090.00816.94
7.3.120.0060.00815.26
7.2.330.0170.00016.74
7.2.320.0070.01016.91
7.2.310.0100.00716.94
7.2.300.0130.00917.05
7.2.290.0060.01116.82
7.2.60.0060.00917.05
7.2.00.0110.00719.74
7.1.200.0060.00616.04
7.1.100.0070.00318.50
7.1.70.0000.00817.28
7.1.60.0120.01219.70
7.1.50.0100.01316.89
7.1.00.0070.07322.32
7.0.200.0000.01016.84
7.0.140.0030.07321.92
7.0.60.0070.06319.93
7.0.50.0070.07717.88
7.0.40.0130.03320.25
7.0.30.0500.03320.24
7.0.20.0330.07320.26
7.0.10.0270.06320.05
7.0.00.0070.08320.21
5.6.280.0000.07720.92
5.6.210.0130.06020.76
5.6.200.0130.06718.16
5.6.190.0100.08020.57
5.6.180.0300.07720.61
5.6.170.0230.05320.48
5.6.160.0070.08720.48
5.6.150.0070.08318.12
5.6.140.0070.07718.24
5.6.130.0030.09318.27
5.6.120.0070.07720.97
5.6.110.0070.05021.13
5.6.100.0030.04721.02
5.6.90.0070.03720.99
5.6.80.0170.07020.52
5.6.70.0430.05720.36
5.5.350.0230.07020.33
5.5.340.0130.05317.98
5.5.330.0070.04020.42
5.5.320.0270.06020.41
5.5.310.0200.08320.25
5.5.300.0100.08017.98
5.5.290.0070.05017.95
5.5.280.0100.08320.79
5.5.270.0100.07720.88
5.5.260.0100.08020.81
5.5.250.0070.08720.70
5.5.240.0070.03320.28
5.4.450.0900.05319.20
5.4.440.0800.05719.21
5.4.430.0930.05319.46
5.4.420.0670.00019.42
5.4.410.0170.06318.86
5.4.400.0300.05018.91
5.4.390.0170.06018.80
5.4.380.0270.04318.60
5.4.370.0100.05318.81
5.4.360.0030.04318.57
5.4.350.0070.03312.04
5.4.340.0050.03912.03
5.4.320.0050.04512.52
5.4.310.0080.04412.51
5.4.300.0060.03612.52
5.4.290.0040.04212.52
5.4.280.0020.03912.41
5.4.270.0100.03812.41
5.4.260.0070.03912.41
5.4.250.0040.03912.41
5.4.240.0100.04312.41
5.4.230.0080.04312.40
5.4.220.0080.03412.40
5.4.210.0060.03612.40
5.4.200.0080.03612.40
5.4.190.0070.03812.40
5.4.180.0080.03512.40
5.4.170.0090.03812.40
5.4.160.0080.03412.41
5.4.150.0070.03512.40
5.4.140.0040.03912.08
5.4.130.0070.03712.07
5.4.120.0080.04112.03
5.4.110.0060.03712.03
5.4.100.0080.03212.02
5.4.90.0060.03812.02
5.4.80.0080.04112.03
5.4.70.0050.04112.02
5.4.60.0070.03312.02
5.4.50.0060.03412.02
5.4.40.0070.04312.01
5.4.30.0090.03312.01
5.4.20.0070.03812.00
5.4.10.0070.03512.00
5.4.00.0040.03811.50
5.3.290.0060.04112.80
5.3.280.0070.04312.71
5.3.270.0070.04112.73
5.3.260.0120.03412.72
5.3.250.0050.04612.71
5.3.240.0060.03812.72
5.3.230.0060.03912.71
5.3.220.0070.03712.68
5.3.210.0060.04512.68
5.3.200.0100.03812.68
5.3.190.0060.03712.67
5.3.180.0070.03812.68
5.3.170.0070.03612.67
5.3.160.0060.04312.68
5.3.150.0090.03412.67
5.3.140.0060.03712.66
5.3.130.0110.03612.66
5.3.120.0050.04012.65
5.3.110.0100.04212.66
5.3.100.0070.03612.14
5.3.90.0060.03712.12
5.3.80.0070.03512.11
5.3.70.0070.03512.11
5.3.60.0050.04112.09
5.3.50.0080.03512.04
5.3.40.0080.03512.04
5.3.30.0050.03612.00
5.3.20.0090.04011.78
5.3.10.0080.03411.75
5.3.00.0040.04011.73
5.2.170.0040.0329.26
5.2.160.0040.0309.25
5.2.150.0060.0289.26
5.2.140.0040.0319.25
5.2.130.0070.0339.21
5.2.120.0070.0339.21
5.2.110.0060.0359.22
5.2.100.0030.0309.21
5.2.90.0020.0319.21
5.2.80.0090.0359.21
5.2.70.0040.0309.21
5.2.60.0060.0299.16
5.2.50.0050.0309.13
5.2.40.0080.0289.11
5.2.30.0040.0309.09
5.2.20.0030.0309.08
5.2.10.0040.0298.99
5.2.00.0070.0318.86
5.1.60.0090.0278.14
5.1.50.0060.0268.13
5.1.40.0050.0248.11
5.1.30.0040.0298.47
5.1.20.0050.0268.49
5.1.10.0070.0278.21
5.1.00.0010.0318.18
5.0.50.0050.0246.70
5.0.40.0010.0296.55
5.0.30.0040.0336.37
5.0.20.0040.0196.35
5.0.10.0020.0216.33
5.0.00.0020.0376.32
4.4.90.0020.0254.77
4.4.80.0050.0174.76
4.4.70.0050.0134.75
4.4.60.0010.0174.75
4.4.50.0040.0174.77
4.4.40.0040.0264.71
4.4.30.0040.0144.76
4.4.20.0040.0144.84
4.4.10.0030.0164.85
4.4.00.0030.0244.76
4.3.110.0030.0224.67
4.3.100.0020.0154.67
4.3.90.0020.0164.63
4.3.80.0030.0244.62
4.3.70.0020.0164.63
4.3.60.0040.0134.63
4.3.50.0040.0174.63
4.3.40.0030.0284.57
4.3.30.0020.0163.38
4.3.20.0010.0233.36
4.3.10.0010.0163.32
4.3.00.0130.0206.71

preferences:
52.02 ms | 401 KiB | 5 Q