# Zend_Ldap_Filter

## Zend_Ldap_Filter API

Method | Description
--- | ---
`Zend_Ldap_Filter equals(string $attr, string $value)` | Creates an 'equals' filter: `(attr=value)`.
`Zend_Ldap_Filter begins(string $attr, string $value)` | Creates an 'begins with' filter: `(attr=value*)`.
`Zend_Ldap_Filter ends(string $attr, string $value)` | Creates an 'ends with' filter: `(attr=*value)`.
`Zend_Ldap_Filter contains(string $attr, string $value)` | Creates an 'contains' filter: `(attr=*value*)`.
`Zend_Ldap_Filter greater(string $attr, string $value)` | Creates an 'greater' filter: `(attr>value)`.
`Zend_Ldap_Filter greaterOrEqual(string $attr, string $value)` | Creates an 'greater or equal' filter: `(attr>=value)`.
`Zend_Ldap_Filter less(string $attr, string $value)` | Creates an 'less' filter: `(attr<value)`.
`Zend_Ldap_Filter lessOrEqual(string $attr, string $value)` | Creates an 'less or equal' filter: `(attr<=value)`.
`Zend_Ldap_Filter approx(string $attr, string $value)` | Creates an 'approx' filter: `(attr~=value)`.
`Zend_Ldap_Filter any(string $attr)` | Creates an 'any' filter: `(attr=*)`.
`Zend_Ldap_Filter string(string $filter)` | Creates a simple custom string filter. The user is responsible for all value-escaping as the filter is used as is.
`Zend_Ldap_Filter mask(string $mask, string $value,...)` | Creates a filter from a string mask. All `$value` parameters will be escaped and substituted into `$mask` by using `sprintf()`
`Zend_Ldap_Filter andFilter(Zend_Ldap_Filter_Abstract $filter,...)` | Creates an 'and' filter from all arguments given.
`Zend_Ldap_Filter orFilter(Zend_Ldap_Filter_Abstract $filter,...)` | Creates an 'or' filter from all arguments given.
`__construct(string $attr, string $value, string $filtertype, string|null $prepend, string|null $append)` | Constructor. Creates an arbitrary filter according to the parameters supplied. The resulting filter will be a concatenation `$attr . $filtertype . $prepend . $value . $append`. Normally this constructor is not needed as all filters can be created by using the apprpriate factory methods.
`string toString()` | Returns a string representation of the filter.
`string __toString()` | Returns a string representation of the filter. Proxies to `Zend_Ldap_Filter::toString()`.
`Zend_Ldap_Filter_Abstract negate()` | Negates the current filter.
`Zend_Ldap_Filter_Abstract addAnd(Zend_Ldap_Filter_Abstract $filter,...)` | Creates an 'and' filter from the current filter and all filters passed in as the arguments.
`Zend_Ldap_Filter_Abstract addOr(Zend_Ldap_Filter_Abstract $filter,...)` | Creates an 'or' filter from the current filter and all filters passed in as the arguments.

`string|array escapeValue(string|array $values)`

Escapes the given `$values` according to RFC 2254 so that they can be safely used in LDAP filters. If a single string is given, a string is returned - otherwise an array is returned. Any control characters with an ASCII code < 32 as well as the characters with special meaning in LDAP filters "*", "(", ")", and "\" (the backslash) are converted into the representation of a backslash followed by two hex digits representing the hexadecimal value of the character.

`string|array unescapeValue(string|array $values)` | Undoes the conversion done by `Zend_Ldap_Filter::escapeValue()`. Converts any sequences of a backslash followed by two hex digits into the corresponding character.