PHP.nl

bin2hex

bin2hex

Convert binary data into hexadecimal representation

string **bin2hex** string $string

Returns an ASCII string containing the hexadecimal representation of . The conversion is done byte-wise with the high-nibble first. string

stringA string.

Returns the hexadecimal representation of the given string.

Voorbeeld: example

<?php

$hex = bin2hex('Hello world!');

var_dump($hex);
var_dump(hex2bin($hex));
?>
string(24) "48656c6c6f20776f726c6421"
string(12) "Hello world!"

hex2bin``pack