src/LdapTools/Utilities/LdapUtilities.php
public static function explodeDn($dn, $withAttributes = 1)
    {
        $pieces = ldap_explode_dn($dn, $withAttributes);

        if ($pieces === false || !isset($pieces['count']) || $pieces['count'] == 0) {
            throw new InvalidArgumentException(sprintf('Unable to parse DN "%s".', $dn));
        }
        for ($i = 0; $i < $pieces['count']; $i++) {
            $pieces[$i] = self::unescapeValue($pieces[$i]);
        }
        unset($pieces['count']);

        return $pieces;
    }
public static function explodeDn($dn, $withAttributes = 1)
    {
        $pieces = ldap_explode_dn($dn, $withAttributes);

        if ($pieces === false || !isset($pieces['count']) || $pieces['count'] == 0) {
            throw new InvalidArgumentException(sprintf('Unable to parse DN "%s".', $dn));
        }
        for ($i = 0; $i < $pieces['count']; $i++) {
            $pieces[$i] = self::unescapeValue($pieces[$i]);
        }
        unset($pieces['count']);

        return $pieces;
    }
public static function explodeDn ( $ dn , $ withAttributes = 1 ) { $ pieces = ldap_explode_dn ( $ dn , $ withAttributes ) ; if ( $ pieces === false || ! isset ( $ pieces [ 'count' ] ) || $ pieces [ 'count' ] == 0 ) { throw new InvalidArgumentException ( sprintf ( 'Unable to parse DN "%s".' , $ dn ) ) ; } for ( $ i = 0 ; $ i < $ pieces [ 'count' ] ; $ i ++ ) { $ pieces [ $ i ] = self :: unescapeValue ( $ pieces [ $ i ] ) ; } unset ( $ pieces [ 'count' ] ) ; return $ pieces ; }
Converts a string distinguished name into its separate pieces.

@param string $dn
@param int $withAttributes Set to 0 to get the attribute names along with the value.
@return array
Converts a string distinguished name into its separate pieces .