note 49969 added to function.base-convert

From: Date: Mon, 14 Feb 2005 05:52:36 +0000
Subject: note 49969 added to function.base-convert
Groups: php.notes 
Request: Send a blank email to php-notes+get-84995@lists.php.net to get a copy of this message
There are a few functions posted here to inverse or invert a hex color code yet none of them have actually worked for me. This function will take a hex color code string such as '#00FF00' and return the inversed or inverted hex color code string of '#FF00FF'. <? function inverseColor($hex) { if(substr($hex, 0, 1) == '#') $hex = substr($hex, 1); $r = str_pad(dechex(255 - hexdec(substr($hex, 0, 2)) ),2,'0',STR_PAD_LEFT); $g = str_pad(dechex(255 - hexdec(substr($hex, 2, 2)) ),2,'0',STR_PAD_LEFT); $b = str_pad(dechex(255 - hexdec(substr($hex, 4, 2)) ),2,'0',STR_PAD_LEFT); return strtoupper('#'.$r.$g.$b); } ?> ---- Manual Page -- http://www.php.net/manual/en/function.base-convert.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+49969 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+49969&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+49969&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+49969&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+49969&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+49969&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+49969&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#84995) next »