PHP bin2hex Function

What is bin2hex() function?

Explanation

The bin2hex() function is used to convert binary data to hexadecimal.

Syntax:


bin2hex(string)

In the above syntax the string is converted to hexadecimal numbers.

Example :


<?php
$s = "hello";
echo bin2hex($s)."<br/>";
?>
Result :

48656c6c6f

In the above example the string "hello" is converted to hexadecimal equivalent "48656c6c6f".

PHP Topics


Ask Questions

Ask Question