Greets, I am playing around with usort and an LDAP class. Basically, I want to sort the results of an LDAP search based on a specific criterion. class CLDAP { var $m_Entries; var $m_LinkIdentifier; ... function Connect() { ... } function Bind() { ... } function FindEntries($BaseDN, $Filter) { $ProcName="CLDAP::FindEntries"; $LDAPSearchResult=ldap_search($this->m_LinkIdentifier, "$BaseDN", "$Filter"); if($LDAPSearchResult) { $Entries=ldap_get_entries($this->m_LinkIdentifier, $LDAPSearchResult); if($Entries) { //print "$ProcName: Entries found for filter of $Filter<br>"; $this->m_Entries = $Entries; } else { // No entries //print "$ProcName: No entries found for filter of $Filter<br>"; } } } //************************* //* SORT CLASS MEMBERS //************************* function MySort() { $ProcName = "CLDAP::MySort"; // Sort the entries ; print "$ProcName: BEFORE: " . $this->m_Entries["count"] . "<br>"; usort($this->m_Entries, array($this,"cmp")); print "$ProcName: AFTER: " . $this->m_Entries["count"] . "<br>"; } function cmp ($a, $b) { $ProcName = "CLDAP:cmp"; print "$ProcName: IN COMPARE: " . $this->m_Entries["count"] . "<br>"; return strcmp($a["sn"],$b["sn"]); } } Now, with the above (hacked up) example, I create my LDAP object, connect to an LDAP server and retrieve values based on a DN and Filter. Essentially, I get a multi-dimensional array populated with the results from my LDAP filter, with key references to their attributes ("givenname" = first name, "sn" = last name, etc...). This works! I can populate my object property '$this->m_Entries' with my UNSORTED LDAP results. When I run the $LDAP->MySort() routine, '$this->m_Entries' has values BEFORE the usort function call, but has NULL entries AFTER the function call. '$this->cmp' has values each time it is called. Somehow, my data is being wiped out by usort after I return from '$this->cmp'. The above example is attempting to sort my LDAP results by "sn", or last name in LDAP-ese. What is happening here? Why is my array of results disappearing after the usort? I played with globals, and I even saved my array into a temp variable and used that instead. The temp variable is fine before the usort, but is totally gone after. Any help is appreciated! Cheers, Jason -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]