PHP hexdec( ) Function Last Updated : 22 Jun, 2023 Comments Improve Suggest changes Like Article Like Report Hexadecimal is a positional numeral system with a base of 16. It has sixteen distinct symbols, where the first nine symbols are 0–9 which represent values zero to nine, and the rest 6 symbols are A, B, C, D, E, F which represent values from ten to fifteen respectively. Since hexadecimal digit represents four binary digits, it allows a more human-friendly representation of binary-coded values and hence it is preferred over other number systems like binary and octal. The hexdec() function in PHP converts a hexadecimal number to a decimal number. The hexdec() function converts numbers that are too large to fit into the integer type, larger values are returned as a float in that case. If hexdec() encounters any non-hexadecimal characters, it ignores them. Syntax: hexdec($value) Parameters: The hexdec() function accepts a single parameter $value. It is the hexadecimal number whose decimal equivalent you want to calculate. Return Value: The hexdec() function in PHP returns the decimal equivalent of a hexadecimal number. Examples: Input : hexdec("5e") Output : 94 Input : hexdec("a") Output : 10 Input : hexdec("f1f1") Output : 61937 Input : hexdec("abc451") Output : 11256913 Below program illustrate the working of hexdec() in PHP: PHP <?php echo hexdec("5e") . "\n"; echo hexdec("a") . "\n"; echo hexdec("f1f1") . "\n"; echo hexdec("abc451") . "\n"; ?> Output: 94 10 61937 11256913 Important points to note : It converts a hexadecimal number to its decimal equivalent. It returns the values as float if the numbers are too large to be returned as integer type . The hexadecimal number system is one of the most popular and widely used number system these days. Reference: http://php.net/manual/en/function.hexdec.php Comment More infoAdvertise with us Next Article PHP hexdec( ) Function S Shubrodeep Banerjee Follow Improve Article Tags : Misc Web Technologies PHP PHP-function Practice Tags : Misc Similar Reads PHP octdec( ) Function In the earlier days of computing, octal numbers and the octal numbering system was very popular for counting inputs and outputs because as it works in counts of eight, inputs and outputs were in counts of eight, a byte at a time. Due to a wide usage of octal number system many times it happens that 2 min read PHP | imagesx() Function The imagesx() function is an inbuilt function in PHP which is used to return the width of the given image. Syntax: int imagesx( $image ) Parameters: This function accepts single parameters $image which is mandatory. This $image variable can store the image created by imagecreatetruecolor() image cre 1 min read PHP Math Functions PHP is a scripting language that comes with many built-in math functions and constants. These tools help you do basic math, solve more complex problems, and work with different math concepts. This guide gives an overview of PHP's math functions and constants, along with examples, practical uses, and 5 min read PHP IntlChar::ord() Function The IntlChar::ord() function is an inbuilt function in PHP which is used to return the Unicode code point value of the given character. Syntax: int IntlChar::ord( $character ) Parameters: This function accepts a single parameter $character which is mandatory. This parameter is a Unicode character. R 2 min read PHP DsSet get() Function The Ds\Set::get() function of Ds\Set class in PHP is an inbuilt function which is used to get a value from the Set instance. This function is used to fetch a value present at a particular index in the Set instance. Syntax: mixed public Ds\Set::get ( int $index ) Parameters: This function accepts a s 2 min read PHP | DsStack peek() Function The Ds\Stack::peek() function of PHP is used to get the element present at the top of the Stack instance. This function just returns the top element of the stack without removing it from the stack. Syntax: mixed public Ds\Stack::peek ( void ) Parameters: This function does not accept any parameters. 1 min read PHP fdiv() Function The fdiv() is an inbuilt PHP function that returns the result of a division of 2 numbers(in accordance with IEEE 754). The NaN will never == or === for any value while doing the comparison, even including itself. Syntax: fdiv(float $num1, float $num2): floatParameters: This function accepts 2 parame 1 min read PHP | time() Function The time() function is a built-in function in PHP which returns the current time measured in the number of seconds since the Unix Epoch. The number of seconds can be converted to the current date using date() function in PHP. Syntax: int time() Parameter: This function does not accepts any parameter 2 min read PHP | DsDeque get() Function The Ds\Deque::get() function is an inbuilt function in PHP which is used to return the value at the given index. Syntax: public Ds\Deque::get( $index ) : mixed Parameters: This function accepts single parameter $index which holds the index for which element is to be found. Return Value: This functio 2 min read PHP array() Function The array() function is an inbuilt function in PHP which is used to create an array. There are three types of array in PHP: Indexed array: The array which contains numeric index. Syntax: array( val1, val2, val3, ... ) Associative array: The array which contains name as keys. Syntax: array( key=>v 2 min read Like