Menu Close

bin2hex() function PHP

Codeamend

The bin2hex() function used to Convert binary data into hexadecimal representation

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

Syntax

bin2hex(string) 

Parameter Values

string : The string to be converted.

Technical Details

Return Value : Returns the hexadecimal value of the converted string.

PHP Version : 4+

Examples

<?php
$str = "Codeamend Team";
echo bin2hex($str) . "<br>";
echo pack("H*",bin2hex($str)) . "<br>";
?> 

Output : 
436f6465616d656e64205465616d
Codeamend Team 
Posted in PHP

You can also read...