@ 2014-10-31T19:25:26Z <?php
function HSL2RGB($h, $s, $l)
{
$s = max(0, min($s, 100));
$l = max(0, min($l, 100));
$s = $s/100;
$l = $l/100;
$h = $h >= 360 ? $h % 360 : $h;
$c = ( 1 - abs( 2 * $l - 1 ) ) * $s;
$x = $c * ( 1 - abs( fmod( ( $h / 60 ), 2 ) - 1 ) );
$m = $l - ( $c / 2 );
if ( $h < 60 ) {
$r = $c;
$g = $x;
$b = 0;
} else if ( $h < 120 ) {
$r = $x;
$g = $c;
$b = 0;
} else if ( $h < 180 ) {
$r = 0;
$g = $c;
$b = $x;
} else if ( $h < 240 ) {
$r = 0;
$g = $x;
$b = $c;
} else if ( $h < 300 ) {
$r = $x;
$g = 0;
$b = $c;
} else {
$r = $c;
$g = 0;
$b = $x;
}
$r = ( $r + $m ) * 255;
$g = ( $g + $m ) * 255;
$b = ( $b + $m ) * 255;
return [$r, $g, $b];
}
print_r(50, 100, 100);
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Output for 8.0.0 - 8.0.30 , 8.1.0 - 8.1.28 , 8.2.0 - 8.2.18 , 8.3.0 - 8.3.6 Fatal error: Uncaught ArgumentCountError: print_r() expects at most 2 arguments, 3 given in /in/R1BBX:49
Stack trace:
#0 /in/R1BBX(49): print_r(50, 100, 100)
#1 {main}
thrown in /in/R1BBX on line 49
Process exited with code 255 . Output for 5.4.0 - 5.4.45 , 5.5.24 - 5.5.35 , 5.6.7 - 5.6.28 , 7.0.0 - 7.0.20 , 7.1.0 - 7.1.10 , 7.2.0 - 7.2.33 , 7.3.16 - 7.3.33 , 7.4.0 - 7.4.33 Warning: print_r() expects at most 2 parameters, 3 given in /in/R1BBX on line 49
Output for 4.4.2 - 4.4.9 , 5.1.0 - 5.1.6 , 5.2.0 - 5.2.17 , 5.3.0 - 5.3.29 Parse error: syntax error, unexpected '[' in /in/R1BBX on line 46
Process exited with code 255 . Output for 4.3.0 - 4.3.1 , 4.3.5 - 4.3.11 , 4.4.0 - 4.4.1 , 5.0.0 - 5.0.5 Parse error: parse error, unexpected '[' in /in/R1BBX on line 46
Process exited with code 255 . Output for 4.3.2 - 4.3.4 Parse error: parse error in /in/R1BBX on line 46
Process exited with code 255 . preferences:dark mode live preview
222.67 ms | 401 KiB | 311 Q