PHP bin2hex() Function

4 Sept 2024 | 1 min read

PHP bin2hex() function is used to convert string value of ASSCII characters to hexadecimal value.

Syntax:

ParameterDescriptionRequired/Optional
stringThe string to be convertedRequired

Example 1

Output:

Your ASCII character is:Hello World! By using 'bin2hex()' Method your hexadecimal value is: 48656c6c6f20576f726c6421 

Note: Convert a string value into binary to hex.

Example 2

Output:

Your Hexadecimal Value is 48656c6c6f20776f726c6421 Hello world! 

Example 3

Output:

Your Binary Value is11111001 Converted Binary to Hexadecimal : f9 

Next TopicPHP String