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.0040.01118.43
8.3.50.0110.00522.14
8.3.40.0120.00919.00
8.3.30.0140.00019.04
8.3.20.0070.00020.13
8.3.10.0060.00323.48
8.3.00.0050.00319.79
8.2.180.0030.01618.54
8.2.170.0070.00722.96
8.2.160.0070.00720.39
8.2.150.0000.00824.18
8.2.140.0030.00524.66
8.2.130.0040.00426.16
8.2.120.0000.00820.99
8.2.110.0060.00322.10
8.2.100.0070.00419.95
8.2.90.0040.00419.03
8.2.80.0050.00317.97
8.2.70.0000.00817.72
8.2.60.0030.00617.91
8.2.50.0000.00918.07
8.2.40.0000.00818.22
8.2.30.0000.00818.31
8.2.20.0040.00417.84
8.2.10.0000.00918.07
8.2.00.0040.00417.92
8.1.280.0030.01025.92
8.1.270.0050.00523.91
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0060.00322.06
8.1.230.0040.00719.12
8.1.220.0000.00817.74
8.1.210.0040.00418.77
8.1.200.0030.00617.35
8.1.190.0090.00017.35
8.1.180.0040.00418.10
8.1.170.0030.00518.74
8.1.160.0030.00522.07
8.1.150.0000.00718.87
8.1.140.0000.00717.52
8.1.130.0000.00817.88
8.1.120.0030.00317.47
8.1.110.0060.00317.60
8.1.100.0080.00017.41
8.1.90.0040.00417.46
8.1.80.0040.00417.50
8.1.70.0030.00317.45
8.1.60.0030.00617.69
8.1.50.0030.00517.72
8.1.40.0000.00817.75
8.1.30.0080.00017.74
8.1.20.0060.00317.77
8.1.10.0040.00417.69
8.1.00.0030.00617.71
8.0.300.0070.00018.77
8.0.290.0070.00016.88
8.0.280.0000.00718.43
8.0.270.0040.00417.14
8.0.260.0000.00717.23
8.0.250.0000.00817.10
8.0.240.0030.00316.99
8.0.230.0000.00717.14
8.0.220.0070.00016.98
8.0.210.0000.00716.94
8.0.200.0070.00017.00
8.0.190.0000.00917.11
8.0.180.0050.00517.05
8.0.170.0000.00817.10
8.0.160.0000.00717.05
8.0.150.0050.00316.96
8.0.140.0000.00917.01
8.0.130.0030.00313.51
8.0.120.0000.00817.05
8.0.110.0040.00417.07
8.0.100.0050.00316.94
8.0.90.0050.00217.13
8.0.80.0090.01217.11
8.0.70.0080.00017.05
8.0.60.0000.00716.90
8.0.50.0000.00816.96
8.0.30.0100.01017.12
8.0.20.0080.01117.40
8.0.10.0000.00717.19
8.0.00.0130.00517.00
7.4.330.0020.00215.05
7.4.320.0030.00316.69
7.4.300.0000.00616.75
7.4.290.0070.00016.84
7.4.280.0060.00316.83
7.4.270.0070.00016.70
7.4.260.0070.00416.85
7.4.250.0080.00016.66
7.4.240.0020.00516.74
7.4.230.0000.00716.49
7.4.220.0070.01116.96
7.4.210.0040.01016.71
7.4.200.0050.00316.84
7.4.160.0050.01116.71
7.4.150.0160.01017.40
7.4.140.0110.00817.86
7.4.130.0160.00316.72
7.4.120.0090.00916.79
7.4.110.0100.01316.79
7.4.100.0090.00916.68
7.4.90.0140.00316.80
7.4.80.0090.00919.39
7.4.70.0130.00716.58
7.4.60.0100.01016.78
7.4.50.0060.00316.55
7.4.40.0090.00916.66
7.4.30.0060.00916.75
7.4.00.0030.01415.07
7.3.330.0080.00013.46
7.3.320.0030.00313.55
7.3.310.0040.00416.47
7.3.300.0030.00616.44
7.3.290.0140.00016.63
7.3.280.0100.00516.63
7.3.270.0140.00817.40
7.3.260.0140.00416.70
7.3.250.0090.01516.71
7.3.240.0130.00716.65
7.3.230.0120.00416.60
7.3.210.0120.00916.57
7.3.200.0140.00319.39
7.3.190.0030.01316.60
7.3.180.0030.01216.64
7.3.170.0100.00616.78
7.3.160.0090.00616.62
7.3.120.0100.00615.10
7.2.330.0130.00316.91
7.2.320.0160.00616.79
7.2.310.0080.00816.86
7.2.300.0080.00816.92
7.2.290.0100.00616.84
7.2.60.0110.00417.12
7.2.00.0110.00719.76
7.1.200.0000.01216.13
7.1.100.0070.00518.37
7.1.70.0000.00717.48
7.1.60.0100.01419.70
7.1.50.0070.01417.21
7.1.00.0030.07722.36
7.0.200.0000.00916.59
7.0.140.0070.07021.92
7.0.60.0030.08319.91
7.0.50.0130.06717.90
7.0.40.0100.04319.98
7.0.30.0270.08020.11
7.0.20.0370.07020.12
7.0.10.0130.04320.08
7.0.00.0130.07020.25
5.6.280.0000.07720.83
5.6.210.0100.06320.68
5.6.200.0100.06318.29
5.6.190.0100.04020.63
5.6.180.0400.06020.63
5.6.170.0230.06020.55
5.6.160.0070.09020.61
5.6.150.0130.07318.14
5.6.140.0070.03718.21
5.6.130.0000.06018.18
5.6.120.0030.05321.03
5.6.110.0100.08320.99
5.6.100.0070.08021.12
5.6.90.0070.06020.98
5.6.80.0000.04020.52
5.5.350.0270.05720.35
5.5.340.0170.07718.08
5.5.330.0070.04020.36
5.5.320.0030.06320.31
5.5.310.0200.05320.28
5.5.300.0130.07717.92
5.5.290.0070.08017.98
5.5.280.0100.08720.86
5.5.270.0100.08720.73
5.5.260.0000.04720.80
5.5.250.0070.08020.70
5.5.240.0030.08020.07
5.4.450.0730.05019.57
5.4.440.0130.06019.58
5.4.430.0730.05719.47
5.4.420.1130.06719.46
5.4.410.0800.05019.34
5.4.400.1030.04019.15
5.4.390.0170.04719.12
5.4.380.0130.06018.57
5.4.370.0070.06018.72
5.4.360.0070.06018.57
5.4.350.0030.06318.74
5.4.340.0270.04318.61
5.4.320.0050.04212.52
5.4.310.0090.03412.51
5.4.300.0060.03812.52
5.4.290.0050.04012.51
5.4.280.0080.03312.41
5.4.270.0080.03412.41
5.4.260.0100.03412.41
5.4.250.0060.03812.41
5.4.240.0060.03612.40
5.4.230.0050.03812.40
5.4.220.0080.04112.40
5.4.210.0090.03112.39
5.4.200.0050.03812.40
5.4.190.0060.03812.39
5.4.180.0060.03612.39
5.4.170.0060.03612.40
5.4.160.0030.03912.40
5.4.150.0080.03412.40
5.4.140.0060.03712.08
5.4.130.0050.03612.07
5.4.120.0080.03312.02
5.4.110.0080.03312.02
5.4.100.0090.03612.02
5.4.90.0060.03712.02
5.4.80.0080.03512.02
5.4.70.0040.03612.02
5.4.60.0040.03712.02
5.4.50.0030.03812.02
5.4.40.0060.03512.01
5.4.30.0070.03512.00
5.4.20.0040.03712.00
5.4.10.0040.04112.00
5.4.00.0060.03711.50
5.3.290.0050.04012.80
5.3.280.0060.04012.71
5.3.270.0050.04012.73
5.3.260.0070.03912.72
5.3.250.0100.05112.72
5.3.240.0070.03612.71
5.3.230.0060.03812.71
5.3.220.0050.03812.68
5.3.210.0070.05312.68
5.3.200.0090.03812.68
5.3.190.0050.03812.68
5.3.180.0040.03912.68
5.3.170.0060.03712.67
5.3.160.0090.03612.67
5.3.150.0110.03212.67
5.3.140.0070.03612.66
5.3.130.0060.04012.66
5.3.120.0080.03712.66
5.3.110.0040.04112.66
5.3.100.0080.03412.13
5.3.90.0030.03912.11
5.3.80.0050.03812.11
5.3.70.0100.03212.11
5.3.60.0070.03412.09
5.3.50.0050.03812.04
5.3.40.0090.03412.04
5.3.30.0050.03812.00
5.3.20.0060.03811.78
5.3.10.0030.03811.75
5.3.00.0060.03611.73
5.2.170.0050.0319.24
5.2.160.0070.0279.24
5.2.150.0050.0319.23
5.2.140.0060.0309.23
5.2.130.0050.0299.19
5.2.120.0050.0289.20
5.2.110.0040.0299.20
5.2.100.0050.0309.19
5.2.90.0040.0309.19
5.2.80.0060.0299.19
5.2.70.0020.0329.18
5.2.60.0040.0319.14
5.2.50.0050.0309.11
5.2.40.0060.0279.09
5.2.30.0060.0299.07
5.2.20.0050.0299.05
5.2.10.0040.0308.97
5.2.00.0060.0288.84
5.1.60.0040.0248.13
5.1.50.0010.0298.12
5.1.40.0050.0258.11
5.1.30.0030.0288.44
5.1.20.0050.0308.47
5.1.10.0040.0328.20
5.1.00.0030.0278.20
5.0.50.0020.0226.67
5.0.40.0050.0186.54
5.0.30.0020.0326.35
5.0.20.0020.0206.32
5.0.10.0030.0206.31
5.0.00.0040.0306.30
4.4.90.0020.0164.78
4.4.80.0040.0144.75
4.4.70.0020.0164.75
4.4.60.0010.0174.76
4.4.50.0070.0124.77
4.4.40.0020.0264.71
4.4.30.0030.0154.76
4.4.20.0020.0164.84
4.4.10.0030.0154.84
4.4.00.0050.0264.76
4.3.110.0020.0224.67
4.3.100.0050.0164.67
4.3.90.0000.0174.64
4.3.80.0030.0244.60
4.3.70.0030.0154.63
4.3.60.0040.0134.63
4.3.50.0030.0214.63
4.3.40.0020.0244.55
4.3.30.0020.0163.36
4.3.20.0010.0173.34
4.3.10.0020.0163.29
4.3.00.0030.02014.59

preferences:
37.2 ms | 401 KiB | 5 Q