PHP bin2hex() Function
PHP

PHP bin2hex() Function

Editorial Team
Editorial Team

Follow us on Discord or Telegram to get access to free tutorials and updates.

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.