note 57303 added to function.hexdec

From: Date: Fri, 30 Sep 2005 01:38:33 +0000
Subject: note 57303 added to function.hexdec
Groups: php.notes 
Request: Send a blank email to php-notes+get-96022@lists.php.net to get a copy of this message
I made this for a little phpbb mod. It was used to take the hex value from the database and make a color 20 (in decimal) less, resulting a darker color. EXAMPLE: #336699 to #1f5285 <?php $row1 = "336699"; // color $c = 20; // difference value $rgb = array(substr($row1,0,2), substr($row1,2,2), substr($row1,4,2)); for($i=0; $i < 3; $i++) { if((hexdec($rgb[$i])-$c) >= 0) { $rgb[$i] = hexdec($rgb[$i])-$c; $rgb[$i] = dechex($rgb[$i]); if(hexdec($rgb[0]) <= 9) $rgb[$i] = "0".$rgb[$i]; } else { $rgb[$i] = "00"; } } $row2 = $rgb[0].$rgb[1].$rgb[2]; ?> ---- Manual Page -- http://www.php.net/manual/en/function.hexdec.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+57303 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+57303&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+57303&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+57303&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+57303&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+57303&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+57303&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+57303&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+57303&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#96022) next »