Home » PHP bin2hex() function

PHP bin2hex() function

by Online Tutorials Library

PHP bin2hex() Function

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

Syntax:

Parameter Description Required/Optional
string The string to be converted Required

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

You may also like