note 98026 added to function.ldap-sort
[email protected] Fri, 21 May 2010 00:55:08 -0700
Newsgroups
php.notes
Message-ID
<[email protected] >
// Fixed ldap_multi_sort
//
function ldap_multi_sort(&$entries, $attribs)
{
for ($i=1; $i<$entries['count']; $i++)
{
$index = $entries[$i];
$j = $i;
do {
$a = $b = "";
foreach ($attribs as $attrib)
{
$a .= (isSet($entries[$j-1][$attrib][0]) ? $entries[$j-1][$attrib][0] : " ");
$b .= (isSet($index[$attrib][0]) ? $index[$attrib][0] : " ");
}
// do the comparison
if ($a > $b)
{
$is_greater = true;
$entries[$j] = $entries[$j-1];
$j = $j - 1;
} else {
$is_greater = false;
}
} while ($j > 0 AND $is_greater);
$entries[$j] = $index;
}
return $entries;
}
// Example
//
$info = ldap_multi_sort($info, array('department', 'displayname'));
----
Server IP: 78.41.104.8
Probable Submitter: 194.190.20.163
----
Manual Page -- http://www.php.net/manual/en/function.ldap-sort.php
Edit -- https://master.php.net/note/edit/98026
Del: integrated -- https://master.php.net/note/delete/98026/integrated
Del: useless -- https://master.php.net/note/delete/98026/useless
Del: bad code -- https://master.php.net/note/delete/98026/bad+code
Del: spam -- https://master.php.net/note/delete/98026/spam
Del: non-english -- https://master.php.net/note/delete/98026/non-english
Del: in docs -- https://master.php.net/note/delete/98026/in+docs
Del: other reasons-- https://master.php.net/note/delete/98026
Reject -- https://master.php.net/note/reject/98026
Search -- https://master.php.net/manage/user-notes.php