note 70274 added to function.hexdec
| From: | cgarvis at gmail dot com | Date: | Mon, 09 Oct 2006 17:39:45 +0000 |
| Subject: | note 70274 added to function.hexdec | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-118323@lists.php.net to get a copy of this message | ||
Here is my version of hex2rgb for web colors to 24bit colors.
<?php
function hex2rgb_webcolors($hex) {
$hex = eregi_replace("[^a-fA-F0-9]", "", $hex);
switch( strlen($hex) ) {
case 2:
$hex = substr($hex,0,2)."0000";
break;
case 3:
$hex = substr($hex,0,1).substr($hex,0,1)
.substr($hex,1,1).substr($hex,1,1)
.substr($hex,2,1).substr($hex,2,1);
break;
case 4:
$hex = substr($hex,0,4)."00";
break;
case 6:
break;
default:
$hex = 0;
break;
}
return hexdec($hex);
}
?>
----
Server IP: 216.194.113.175
Probable Submitter: 64.48.55.148
----
Manual Page -- http://www.php.net/manual/en/function.hexdec.php
Edit -- https://master.php.net/note/edit/70274
Del: integrated -- https://master.php.net/note/delete/70274/integrated
Del: useless -- https://master.php.net/note/delete/70274/useless
Del: bad code -- https://master.php.net/note/delete/70274/bad+code
Del: spam -- https://master.php.net/note/delete/70274/spam
Del: non-english -- https://master.php.net/note/delete/70274/non-english
Del: in docs -- https://master.php.net/note/delete/70274/in+docs
Del: other reasons-- https://master.php.net/note/delete/70274
Reject -- https://master.php.net/note/reject/70274
Search -- https://master.php.net/manage/user-notes.php