PHP bin2hex() Function
Definition
The bin2hex() function converts a string of binary to hexadecimal values.
Syntax
bin2hex() Function has the following syntax.
bin2hex(string)
Parameter
Parameter | Is Reqired | Description |
---|---|---|
string | Required. | The string to be converted |
Return
PHP bin2hex() function returns the hexadecimal string.
Example
Convert binary to hexadecimal values:
<?php
$str = bin2hex("11111001");
echo($str);
?>
The code above generates the following result.