PHP bin2hex() Function

PHP bin2hex() function is used to convert binary data into equalant hexadecimal.

Syntax

string bin2hex(str);

bin2hex() Function Parameter

ParameterDescription
str :Required parameter. A string or text.

bin2hex() Function Return Value

Return Value :Returns the hexadecimal representation of the given string.

bin2hex() Function Example

<?php
echo bin2hex("Hello world!");
?>