boolean fetch(string dn)
The fetch() function is used to get an array of the returned attributes from a previous search. After using, search(), ls(), or cat(), you can then use fetch() to retrieve the attributes and values from the returned DN. If your search returned multiple results, the first call to fetch will return the attributes and values for the first returned entry. Successive calls to fetch will iterate through the returned values. FALSE is returned if there are no more entries.

To reset the result index back to the first returned entry, use the resetResult() function.

To get the DN of the last entry returned, use the getDN() function.


$ldap = new LDAP();
while($attrs = $ldap->fetch())
	echo $attrs["cn"] . "<br>";