PHP Function LDAP_ERRNO
PHP’s built-in support for LDAP makes it easy to use an LDAP directory server to store and retrieve user information. In this article, we’ll take a closer look at the steps involved in a basic LDAP session, and explore how php function ldap_errno makes it possible to record and display errors from LDAP commands.
What is a PHP Function?
A PHP function is a small piece of code that performs a specific task and can be reused in multiple contexts. A function is like a recipe, with a name and a set of parameters that determine how the code will work. The function is called when you need to use it. Arguments are the values that the function takes in, and they are passed by value to the function. You can pass as many arguments as you need, but they must be separated by commas. If you want to ensure that your function’s return value is of a certain type, you can enable PHP’s strict function declarations feature.
In the example above, we connect to an LDAP server with ldap_bind(), and then use the ldap_search() function to query the server for entry data. The first value that we need is the base DN of the entry – this is usually the DN of the person or group who owns the entry. The second value is the search filter, which will define the attributes that should be included in the result set.