ldap_compare

PHP 4 >= 4.0.2, PHP 5, PHP 7, PHP 8
ldap_compare - Compare value of attribute found in entry specified with DN
Manual
Code Examples

ldap_compare(
     LDAP\Connection$ldap,
     string$dn,
     string$attribute,
     string$value,
     [array|null$controls = null]
): bool|int

Compare value of attribute with value of same attribute in an LDAP directory entry.

Parameters

ldap

An LDAP\Connection instance, returned by ldap_connect.

dn

The distinguished name of an LDAP entity.

attribute

The attribute name.

value

The compared value.

controls

Array of LDAP Controls to send with the request.

Return Values

Returns true if value matches otherwise returns false. Returns -1 on error.

Notes

Warning:

ldap_compare can NOT be used to compare BINARY values!

Changelog

Version Description
8.1.0 The ldap parameter expects an LDAP\Connection instance now; previously, a resource was expected.
8.0.0 controls is nullable now; previously, it defaulted to [].
7.3 Support for controls added

Example of ldap_compare

Show all examples for ldap_compare

PHP Version: