Easy Tutorial
❮ Func Math Deg2Rad Php Functions ❯

PHP bin2hex() Function

PHP String Reference Manual

Example

Convert "Hello World!" to its hexadecimal value:


Definition and Usage

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


Syntax

Parameter Description
string Required. Specifies the string to convert.

Technical Details

Return Value: Returns the hexadecimal value of the converted string.
PHP Version: 4+
--- ---

More Examples

Example 1

Convert a string value from binary to hexadecimal and back:


❮ Func Math Deg2Rad Php Functions ❯