PHP bin2hex() Function

The bin2hex() function converts a string of ASCII characters to hexadecimal values. The string can be converted back using the pack() function.

string bin2hex ( string $str )

Returns an ASCII string containing the hexadecimal representation of str. The conversion is done byte-wise with the high-nibble first.

Example -

ParameterDescription
strA string.

Returns the hexadecimal representation of the given string.