Site icon T4Tutorials.com

Hexadecimal to Decimal Conversion Code in PHP

Hexadecimal to Decimal Conversion Code in PHP

<html>
<body>
<p>
Hexadecimal to Decimal Conversion Code in PHP
</p>
<?php
echo "hexadecimale value =";
echo "48656c6c6f20576f726c6421<br>";
echo "after conversion <br>";
echo hex2bin("48656c6c6f20576f726c6421");
?>
</body>
</html>

Output

Hexadecimal to Decimal Conversion Code in PHP

hexadecimale value =48656c6c6f20576f726c6421
after conversion 
Hello World!

Hexadecimal to Decimal Conversion Code in PHP with form Values Entered By User

<html>
<h3>PHP Program Code of Hexadecimal to Decimal Conversion </h3>
</html>
<html>
<body>
<form method="post">
Enter hexa Value:<br>
<input type="text" name ="num1"><br>
<input type="submit" name="submit"><br>
</form>
</body>
</html>
<?php
if(isset($_POST['submit'])){
	$hexa=$_POST['num1'];
        echo "The Value after Conversion  <br>";
	echo base_convert($hexa,16,10);
	
	
	;}?>

Output

Figure: Hexadecimal to Decimal Conversion Code in PHP

Topic Covered

Hexadecimal to Decimal Conversion Code in PHP.

Exit mobile version