Dechex Function in PHP Example

Dechex Function in PHP Example. A Php program to print the number using dechex. In this, we can convert the number into decimal numbers to string in PHP. The dechex() function is a PHP built-in function that converts a decimal value to an equivalent hexadecimal number. The greatest number that can be converted to decimal is 4294967295, which equals “fffffff”.

<?php 
echo (dechex(20)."<br/>");
echo (dechex(5)."<br/>");
echo (dechex(100)."<br/>");
?>

 

Output:

14

5

64

dechex() Function in PHP

The dechex() function is a built-in PHP function that converts a given decimal value to an equivalent hexadecimal number. It is the decimal number that you wish to convert to hexadecimal. Return on Investment: It returns the hexadecimal string representation of the integer that was supplied to it as an input. The dechex() function only accepts unsigned values. If the argument it is given is negative, it will be treated as an unsigned number.

Break Statement in Php

The Line Break component. The <br> HTML element inserts a line break into text (carriage-return). It is handy when composing a poem or an address where the line separation is important. In an HTML page, the <br/> element signifies a line break. Similarly, the <br/> element comes in handy for crafting poetry and addresses. This <br/> tag is used to insert a line break or carriage return within a parent element, such as a paragraph, without leaving the parent element.