# LDAP

> Section in “New and Extended Functionality” of the book [PHP 7 Explained](https://php7explained.com/) by Sebastian Bergmann and Stefan Priebsch, published by thePHP.cc. The book covers PHP 7.0 to 7.4 and was last updated in November 2020. HTML version: <https://php7explained.com/new-and-extended-functionality/ldap/>

In PHP 7.3, quite a few new improvements were made to `ext/ldap`, PHP’s extension for the Lightweight Directory Access Protocol (LDAP).

We do not have an environment in which we could test these improvements and therefore cannot provide examples for how they are used. Instead, we can only list the improvements here:

The functions `ldap_add_ext()`, `ldap_bind_ext()`, `ldap_delete_ext()`, `ldap_mod_add_ext()`, `ldap_mod_replace_ext()`, `ldap_mod_del_ext()`, and `ldap_rename_ext()` were added and provide access to the result object to be able to parse it with `ldap_parse_result()`. This gives more detailed information than just “the operation failed” or “the operation was successful”.

The `ldap_exop_refresh()` was added for conveniently performing an extended refresh operation.

Full support for LDAP Controls was added to the LDAP querying functions as well as `ldap_parse_result()`. The `serverctrls` parameter was added to the `ldap_add()`, `ldap_mod_replace()`, `ldap_mod_add()`, `ldap_mod_del()`, `ldap_rename()`, `ldap_compare()`, `ldap_delete()`, `ldap_modify_batch()`, `ldap_search()`, `ldap_list()`, and `ldap_read()` functions for sending controls to the server. The `out` parameter was added to the `ldap_parse_result()` function for getting controls from the server.

The `LDAP_OPT_SERVER_CONTROLS` and `LDAP_OPT_CLIENT_CONTROLS` constants are now handled correctly by the `ldap_get_option()` and `ldap_set_option()` functions.

---

Previous: [MySQL, Prepared Statements, and Fractional Seconds](https://php7explained.com/new-and-extended-functionality/date-and-time/mysql-prepared-statements-and-fractional-seconds/index.html.md) | Next: [Beyond PHP 7.4](https://php7explained.com/beyond-php-7.4/index.html.md)
