The ldap_unbind() function unbinds and closes an existing LDAP server connection.

result = ldap_unbind (LDAP_Connection);
LDAP_Connection Required. An LDAP Server Connection that was created by ldap_ open().
0 Unbind operation successful.
-1 Unbind operation failed.
result = ldap_unbind (ldapConnection);

In this example, an unbind and close are performed on the LDAP server connection ID specified in ldapConnection.

For more information, please see the following: