hex - hexadecimal value
Returns a random hexadecimal value, or converts a decimal to hexadecimal based on the input parameters.
A hexadecimal (also base 16, or hex) is a positional numeral system with a radix, or base, of 16.
Source:
http://en.wikipedia.org/wiki/Hexadecimal
Usage(s)
hex () |
Returns a hexadecimal value in the range 0 to F (0 to 15 decimal) |
hex ( $decimal ) |
Converts a decimal value to a Hexadecimal value |
hex ( $minimum , $maximum ) |
Returns a hexadecimal value in the range $minimum to $maximum |
Parameter(s)
$decimal |
The decimal value to convert.
$decimal must be a decimal integer. |
$minimum |
The minimum value for the range in which the hexadecimal value is randomly generated.
$minimum must be a decimal integer. |
$maximum |
The maximum value for the range in which the hexadecimal value is randomly generated.
$maximum must be a decimal integer larger than $minimum. |
Example(s)
Generating random Hexadecimal values
Patter: #hex(0,255)hex(0,255)hex(0,255)
Would return random HTML color codes:
#c1c47b
#5e398c
#c834be
#668656
#692d94
#7f6b51
#4fa672
#de70b2
#2f2ca4
#738f4
#f0e14c
#9a87d0
#287220
#89741d
#283e1c
#cbe983
#188e85
#47ebd7
#f89df2
#63fc2f
|
Converting decimal values to hexadecimal
Pattern: hex(255)Will always return: FF
|
See also
int - number
guid / uuid - globally / universally unique identifier
bin - binary value
oct - octal values