PHP: Hypertext Preprocessor (original) (raw)
ldap_err2str
(PHP 4, PHP 5, PHP 7, PHP 8)
ldap_err2str — Convert LDAP error number into string error message
Description
Returns the string error message explaining the error numbererrno
. While LDAP errno numbers are standardized, different libraries return different or even localized textual error messages. Never check for a specific error message text, but always use an error number to check.
Parameters
errno
The error number.
Return Values
Returns the error message, as a string.
Examples
Example #1 Enumerating all LDAP error messages
<?php for ($i=0; <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>i</mi><mo><</mo><mn>100</mn><mo separator="true">;</mo></mrow><annotation encoding="application/x-tex">i<100; </annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6986em;vertical-align:-0.0391em;"></span><span class="mord mathnormal">i</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel"><</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:0.8389em;vertical-align:-0.1944em;"></span><span class="mord">100</span><span class="mpunct">;</span></span></span></span>i++) { printf("Error <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>i</mi><mo>:</mo></mrow><annotation encoding="application/x-tex">i: %s<br />\n", ldap_err2str(</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6595em;"></span><span class="mord mathnormal">i</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">:</span></span></span></span>i)); } ?>
See Also
- ldap_errno() - Return the LDAP error number of the last LDAP command
- ldap_error() - Return the LDAP error message of the last LDAP command