PHP bin2hex() Function


The bin2hex() converts a string of ASCII characters to a hexadecimal value.

Syntax
bin2hex(string)
Parameters
  • string - (Required) Specifies the string to convert.
Example
<?php
echo "Hello World"."<br>";
echo "The bin2hex Value:" .bin2hex('Hello World');
?>

Output

Hello World
The bin2hex Value:48656c6c6f20576f726c64

Prev Next