You are here

function ldap_pear_hex2asc in Lightweight Directory Access Protocol (LDAP) 7.2

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

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

@static @author beni@php.net, heavily based on work from DavidSmith@byu.net

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 419
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 ($m) {
    return chr(hexdec($m[1]));
  }, $string);
  return $string;
}