note 5397 modified in function.ldap-mod-del by felipe
| From: | felipe@php.net | Date: | Mon, 26 May 2008 19:44:22 +0000 |
| Subject: | note 5397 modified in function.ldap-mod-del by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-139810@lists.php.net to get a copy of this message | ||
After a couple hours of searching and not finding anything on the ldap_mod_del function worth
anything, I started trying to figure out myself what format the "array entry" parameter
needed to be in. Here is what I found:
The entry array is a hash with the attribute name as the hash key and the specific value you want
deleted for that attribute as the corresponding hash value.
-- Example
Current values for the attributes of of a particular entry:
uid: testuser
mail: testuser@test.net
mail: testuser@somewhere.com
How to remove the first value of mail so that only the second value for mail exists:
$entry["mail"] = "testuser@test.net";
$result = ldap_mod_del($connID, $dn, $entry);
So if you want to remove all instances of an attribute, you have to do it one by one.
--was--
<p>After a couple hours of searching and not finding anything on the ldap_mod_del function
worth anything, I started trying to figure out myself what format the "array entry"
parameter needed to be in. Here is what I found:</p>
<p>The entry array is a hash with the attribute name as the hash key and the specific value
you want deleted for that attribute as the corresponding hash value.</p>
<p><b>Example</b></p>
<p>Current values for the attributes of of a particular entry:</p>
<pre>
uid: testuser
mail: testuser@test.net
mail: testuser@somewhere.com
</pre>
<p>How to remove the first value of mail so that only the second value for mail
exists:</p>
<pre>
$entry["mail"] = "testuser@test.net";
$result = ldap_mod_del($connID, $dn, $entry);
</pre>
<br>
<p>So if you want to remove all instances of an attribute, you have to do it one by
one.</p>
http://php.net/manual/en/function.ldap-mod-del.php