DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Decimal To Hexa Decimal Converter

08.15.2011
| 3566 views |
  • submit to reddit
        This PHP code will convert Decimal to Hexadecimal value
function d2hconvert($decimal){
return dechex($decimal);
}
$decimal=1000;
echo $decimal." equivalent Hexadecimal value is ".d2hconvert($decimal);
?> 
Similarly for hexdec(),hexoct() and hexbin()
To convert Decimal to Binary use 
dechex(hexbin($input));
We can also use this <a href="http://ncalculators.com/number-conversion/decimal-to-binary-hexa-octal-converter.htm">Decimal to Hex Converter</a>