PHP.nl

hexdec

hexdec

Hexadecimal to decimal

 **hexdec** string $hex_string

Returns the decimal equivalent of the hexadecimal number represented by the argument. converts a hexadecimal string to a decimal number. hex_string``hexdec

will ignore any non-hexadecimal 

characters it encounters. As of PHP 7.4.0 supplying any invalid characters is deprecated. hexdec

hex_stringThe hexadecimal string to convert

The decimal representation of hex_string

Voorbeeld: example

<?php
var_dump(hexdec("ee")); // prints "int(238)"
var_dump(hexdec("a0")); // prints "int(160)"
?>

Voorbeeld: with Invalid Characters

<?php
var_dump(hexdec("See"));  // print "int(238)"
var_dump(hexdec("that")); // print "int(10)"
?>

Opmerking: > The function can convert numbers that are too large to fit into the platforms type, larger values are returned as in that case. int``float

dechex``bindec``octdec``base_convert