note 43765 added to function.ldap-get-attributes

From: Date: Fri, 02 Jul 2004 14:59:12 +0000
Subject: note 43765 added to function.ldap-get-attributes
Groups: php.notes 
Request: Send a blank email to php-notes+get-72328@lists.php.net to get a copy of this message
Note that ldap_get_attributes fetches attributes AND values from the LDAP server. Depending on the data stored in the entry, the following code might work a dozen times faster (or even better, but faster in general) than the code in Example 1: <?php // $ds is the link identifier for the directory // $sr is a valid search result from a prior call to // one of the ldap directory search calls $entry = ldap_first_entry($ds, $sr); $attrs = array(); $attribute = ldap_first_attribute($ds,$entry,$identifier); while ($attribute) { $attrs[] = $attribute; $attribute=ldap_next_attribute($ds,$entry,$identifier); } echo count($attrs) . " attributes held for this entry:<p>"; for ($i=0; $i<count($attrs); $i++) { echo $attrs[$i] . "<br />"; } ?> You may want to check the time difference with the function "microtime". ---- Manual Page -- http://www.php.net/manual/en/function.ldap-get-attributes.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+43765 Delete -- http://master.php.net/manage/user-notes.php?action=delete+43765&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+43765&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#72328) next »