Found myself using the PHP function str_pad today to format a hex string as a six digit HTML/CSS colour code.
e.g.:
$code = str_pad( dechex( $rgb ), 6, '0', STR_PAD_LEFT );
The str_pad function is implemented in JavaScript at jsphp.co.
Found myself using the PHP function str_pad today to format a hex string as a six digit HTML/CSS colour code.
e.g.:
$code = str_pad( dechex( $rgb ), 6, '0', STR_PAD_LEFT );
The str_pad function is implemented in JavaScript at jsphp.co.