element. The attributes for the entry may be referenced by name or by number. Each
attribute has its own count element and a numbered set of values.
array ldap_get_values(integer link, integer entry, string
attribute)
The ldap_get_values function returns an array of every value for a given attribute.
The values will be treated as strings. Use ldap_get_values_len if you need to get
binary data.
<?
//connect to LDAP server
if(!($ldap=ldap_connect("ldap.php.net")))
{
die("Could not connect to LDAP server!");
}
//set up search criteria
$dn = "cn=John Smith, dc=php, dc=net";
$filter = "sn=*";
$attributes = array("givenname", "sn", "mail");
//perform search
if(!($result = ldap_read($ldap, $dn, $filter,
$attributes)))
{
die("Nothing Found!");
}
$entry = ldap_first_entry($ldap, $result);
$values = ldap_get_values($ldap, $entry, "mail");
print($values["count"]. " Values:
- \n");
- $values[$index]\n");
}
print("
for($index=0; $index < $values["count"]; $index++)
{
print("
ldap_free_result($result);
?>