PHP bin2hex() function

The bin2hex() function used to convert binary data into hexadecimal representation, and returns an ASCII string containing the hexadecimal representation

Syntax

bin2hex ( string $string ) : string
	

Parameters

Parameter Name Descrption
$string Required, The input string.

Return Value

Return the hexadecimal representation of string.

bin2hex() examples

echo bin2hex("Test String");
//Output :: 5465737420537472696e67

Related Functions

  • hex2bin(): Decodes a hexadecimally encoded binary string