note 98026 deleted from function.ldap-sort by danbrown

From: Date: Fri, 21 May 2010 12:14:29 +0000
Subject: note 98026 deleted from function.ldap-sort by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-169482@lists.php.net to get a copy of this message
Note Submitter: topvic at mail dot ru ---- // 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'));

« previous php.notes (#169482) next »