note 19174 added to function.imap-sort

From: Date: Mon, 18 Feb 2002 18:34:52 +0000
Subject: note 19174 added to function.imap-sort
Groups: php.notes 
Request: Send a blank email to php-notes+get-26756@lists.php.net to get a copy of this message
for those of you with an old version of PHP that doesn't support the extra search paramater you may want to use this function: function order_search($searchresults, $sortresults) { $searchhash = array(); $returnresults = array(); $count = 0; for ($i = 0; $i < sizeof($searchresults); $i++) { $searchhash[$searchresults[$i]] = true; } for ($i = 0; $i < sizeof($sortresults); $i++) { if (@$searchhash[$sortresults[$i]]) { $returnresults[$count] = $sortresults[$i]; $count++; } } return $returnresults; } example of using function: $sortresults = imap_sort($stream, $sort, $sortdir, SE_UID); $searchresults = imap_search($stream, $search, SE_UID); $results = order_search($searchresults, $sortresults); $results will then hold a sorted array of search results. -- http://www.php.net/manual/en/function.imap-sort.php http://master.php.net/manage/user-notes.php?action=edit+19174 http://master.php.net/manage/user-notes.php?action=delete+19174 http://master.php.net/manage/user-notes.php?action=reject+19174

« previous php.notes (#26756) next »