You are here

function ldap_pear_hex2asc in Lightweight Directory Access Protocol (LDAP) 7

Same name and namespace in other branches
  1. 8.2 ldap_servers/ldap_servers.functions.inc \ldap_pear_hex2asc()
  2. 7.2 ldap_servers/ldap_servers.functions.inc \ldap_pear_hex2asc()

Converts all Hex expressions ("\HEX") to their original ASCII characters

@static

Parameters

string $string String to convert:

Return value

string

2 calls to ldap_pear_hex2asc()
ldap_pear_unescape_dn_value in ldap_servers/ldap_servers.functions.inc
Undoes the conversion done by escape_dn_value().
ldap_pear_unescape_filter_value in ldap_servers/ldap_servers.functions.inc
Undoes the conversion done by {@link escape_filter_value()}.

File

ldap_servers/ldap_servers.functions.inc, line 596
collection of functions that don't belong in server object

Code

function ldap_pear_hex2asc($string) {
  $string = preg_replace_callback("/\\\\([0-9A-Fa-f]{2})/", function (array $matches) {
    return chr(hexdec($matches[0]));
  }, $string);
  return $string;
}