"함수 str2rgb()"의 두 판 사이의 차이

9번째 줄: 9번째 줄:
[[category: PHP]]
[[category: PHP]]
<source lang='php'>
<source lang='php'>
function string2rgb( $str, $offset='' ) {
function string2rgb( $str, $salt='' ) {
   $code = dechex(crc32(md5($str.$offset)));
   $code = dechex(crc32(md5($str.$salt)));
   $r = hexdec(substr($code,0,2))/2+127;
   $r = hexdec(substr($code,0,2))/2+127;
   $g = hexdec(substr($code,2,2))/2+127;
   $g = hexdec(substr($code,2,2))/2+127;

2018년 1월 29일 (월) 02:50 판

StringToRGB()
string2color
string to color

1 PHP

function string2rgb( $str, $salt='' ) {
  $code = dechex(crc32(md5($str.$salt)));
  $r = hexdec(substr($code,0,2))/2+127;
  $g = hexdec(substr($code,2,2))/2+127;
  $b = hexdec(substr($code,4,2))/2+127;
  return dechex($r).dechex($g).dechex($b);
}

2 같이 보기

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}