PHP bin2hex() Function

Definition

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

Syntax

bin2hex() Function has the following syntax.

bin2hex(string)

Parameter

ParameterIs Reqired Description
stringRequired. The string to be converted

Return

PHP bin2hex() function returns the hexadecimal string.

Example

Convert binary to hexadecimal values:


<?php 
$str = bin2hex("11111001");
echo($str); 
?>

The code above generates the following result.





















Home »
  PHP Tutorial »
    Function reference »




PHP Array Functions
PHP Calendar Functions
PHP Class Functions
PHP Data Type Functions
PHP Date Functions
PHP File Functions
PHP Image Functions
PHP Math Functions
PHP MySQLi Functions
PHP SimpleXML Functions
PHP String Functions
PHP XML Functions
PHP Zip Functions