PHP bin2hex() Function
PHP

PHP bin2hex() Function

Mishel Shaji
Mishel Shaji

The PHP bin2hex function is used to convert binary data into hexadecimal representation.

Syntax

bin2hex(string_to_convert);

Example

<?php 
    $res = bin2hex("This is binary to hex conversion.");
    echo($res); 
?>

Output

546869732069732062696e61727920746f2068657820636f6e76657273696f6e2e

Here is a list of other PHP string handling functions.