explodeDN()
explodeDN(string $dn, array $options = array()) : array
Explodes the given DN into its elements
RFC 2253 says, a Distinguished Name is a sequence of Relative Distinguished Names (RDNs), which themselves are sets of Attributes. For each RDN a array is constructed where the RDN part is stored.
For example, the DN 'OU=Sales+CN=J. Smith,DC=example,DC=net' is exploded
to:
array(array('OU=Sales', 'CN=J. Smith'),
'DC=example',
'DC=net')
[NOT IMPLEMENTED] DNs might also contain values, which are the bytes of
the BER encoding of the X.500 AttributeValue rather than some LDAP
string syntax. These values are hex-encoded and prefixed with a #. To
distinguish such BER values, explodeDN uses references to the
actual values, e.g. '1.3.6.1.4.1.1466.0=#04024869,DC=example,DC=com' is
exploded to:
array(array('1.3.6.1.4.1.1466.0' => "\004\002Hi"),
array('DC' => 'example',
array('DC' => 'com'))
See http://www.vijaymukhi.com/vmis/berldap.htm for more
information on BER.
It also performs the following operations on the given DN:
- Unescape "\" followed by ",", "+", """, "\", "<", ">", ";", "#", "=", " ", or a hexpair and strings beginning with "#".
- Removes the leading 'OID.' characters if the type is an OID instead of a name.
- If an RDN contains multiple parts, the parts are re-ordered so that the attribute type names are in alphabetical order.
$options is a list of name/value pairs, valid options are:
- casefold: Controls case folding of attribute types names.
Attribute values are not affected by this option.
The default is to uppercase. Valid values are:
- lower: Lowercase attribute types names.
- upper: Uppercase attribute type names. This is the default.
- none: Do not change attribute type names.
- reverse: If true, the RDN sequence is reversed.
- onlyvalues: If true, then only attributes values are returned ('foo' instead of 'cn=foo')
Parameters
string | $dn | The DN that should be exploded. |
array | $options | Options to use. |
Returns
array —Parts of the exploded DN.