- ord: documentation ( source)
<?php
$base16Alphabet = 'abcdefghijklmnop';
$hash = "\x01\x23\x45\x67\x89\xAB\xCD\xEF\x01\x23\x45\x67\x89\xAB\xCD\xEF";
$result = '';
for ($i = 0; $i < 16; $i++) {
$byte = ord($hash[$i]);
$result .= $base16Alphabet[$byte & 0xF0 >> 4] . $base16Alphabet[$byte & 0x0F];
}
echo $result;