The ldap_search() function searches the LDAP directory below the baseDN, using the search criteria that are specified in the search filter. The scope argument defines the scope, or boundaries, of the search.

result = ldap_search (ConnectionId, baseDN, scope, searchfilter, attributeList, attributeFlag);
ConnectionId Required. LDAP Server Connection.
baseDN Required. String that contains the base DN for the search.
scope Required. String that contains a search scope value. Value entries are subtree (search the baseDN and the entire directory below), onelevel (search the baseDN and one level below), and base (search the baseDN only).
searchfilter Required. String that contains search criteria.
attributeList Required. List that identifies the attributes that should be returned. Each list element must be an attribute name. An empty list defaults to all attributes.
attributeFlag Required. Integer that represents either true or false. If set to true, only attribute types are returned. If set to false, both attribute types and values are returned.
LDAP message The search operation was successful.
empty string Unsuccessful search.
result = ldap_search (ConnectionId, "dc=beyondtrust, "dc=com", subtree", "jobcode=mgr", {}, 0);

For more information, please see the following: