note 100725 added to function.hexdec
| From: | OntoDevelopment dot com at osu1 dot php dot net | Date: | Tue, 02 Nov 2010 21:26:21 +0000 |
| Subject: | note 100725 added to function.hexdec | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-173699@lists.php.net to get a copy of this message | ||
I used "k10206 at naver dot com" and expanded it to accept shorthand and #.
<?php
function hex2rgb($hex){
$hex = trim($hex,'#');
if(strlen($hex)==3) $hex=$hex[0].$hex[0].$hex[1].$hex[1].$hex[2].$hex[2];
if(strlen($hex)!=6) return false;
$dec = hexdec($hex);
return
array("R"=>0xFF&($dec>>0x10),"G"=>0xFF&($dec>>0x8),"B"=>0xFF&$dec);
}
?>
----
Server IP: 208.69.120.55
Probable Submitter: 66.207.184.34
----
Manual Page -- http://www.php.net/manual/en/function.hexdec.php
Edit -- https://master.php.net/note/edit/100725
Del: integrated -- https://master.php.net/note/delete/100725/integrated
Del: useless -- https://master.php.net/note/delete/100725/useless
Del: bad code -- https://master.php.net/note/delete/100725/bad+code
Del: spam -- https://master.php.net/note/delete/100725/spam
Del: non-english -- https://master.php.net/note/delete/100725/non-english
Del: in docs -- https://master.php.net/note/delete/100725/in+docs
Del: other reasons-- https://master.php.net/note/delete/100725
Reject -- https://master.php.net/note/reject/100725
Search -- https://master.php.net/manage/user-notes.php