function ldap_pear_asc2hex32 in Lightweight Directory Access Protocol (LDAP) 7
Same name and namespace in other branches
- 8.2 ldap_servers/ldap_servers.functions.inc \ldap_pear_asc2hex32()
- 7.2 ldap_servers/ldap_servers.functions.inc \ldap_pear_asc2hex32()
Converts all ASCII chars < 32 to "\HEX"
@static
Parameters
string $string String to convert:
Return value
string
2 calls to ldap_pear_asc2hex32()
- ldap_pear_escape_dn_value in ldap_servers/
ldap_servers.functions.inc - Escapes a DN value according to RFC 2253
- ldap_pear_escape_filter_value in ldap_servers/
ldap_servers.functions.inc - from pear net_ldap2-2.0.11
File
- ldap_servers/
ldap_servers.functions.inc, line 615 - collection of functions that don't belong in server object
Code
function ldap_pear_asc2hex32($string) {
for ($i = 0; $i < strlen($string); $i++) {
$char = substr($string, $i, 1);
if (ord($char) < 32) {
$hex = dechex(ord($char));
if (strlen($hex) == 1) {
$hex = '0' . $hex;
}
$string = str_replace($char, '\\' . $hex, $string);
}
}
return $string;
}