PHP bin2hex

Education is not limited to just classrooms. It can be gained anytime, anywhere... - Ravi Ranjan (M.Tech-NIT)

PHP : bin2hex() function

Description

The bin2hex() function converts a string of binary characters to hexadecimal values.

Version

(PHP 4 and above)

Syntax

bin2hex(string_name)

Parameter

Name

Description

Required /
Optional

Type

string_name

The string to be converted.

Required

String

Return values

The hexadecimal representation of the given string.

Value Type : String.

Pictorial Presentation

php-string-bin2hex()

Example :

  1.  $string_name='w3resource.com';  

  2.  echo bin2hex($string_name);  

  3. ?>  

Output :

77337265736f757263652e636f6d