September 2001
Intermediate to advanced
768 pages
32h 45m
English
int hexdec(string hex) Returns the decimal value for the given hexadecimal argument.
Returns:
Integer decimal equivalent of a number
Description:
Converts a hexadecimal number represented as a string into its decimal equivalent. If the string is not a valid hexadecimal number, an error is returned. The largest hexadecimal value that can be converted is 0x7fffffff.
You can include the 0x prefix in the hex string or not; hexdec() works regardless.
Version:
PHP 3, PHP 4
See also:
base_convert() bindec() decbin() dechex() decoct() octdec()
Example:
$hex = "11ff"; echo "Hexadecimal: $hex, Decimal: ", hexdec($hex); |
Read now
Unlock full access