note 61688 added to function.imap-sort

From: Date: Thu, 09 Feb 2006 15:42:50 +0000
Subject: note 61688 added to function.imap-sort
Groups: php.notes 
Request: Send a blank email to php-notes+get-103368@lists.php.net to get a copy of this message
I worked a lot with IMAP functions since I wrote a complete webmail and I've got a little tip about the imap_sort function : There is a big difference between : <?php imap_sort($imap, SORTDATE, 1); // and imap_sort($imap, SORTARRIVAL, 1); ?> The first command will issue a >> FETCH 1:last (UID ENVELOPE BODY.PEEK[HEADER.FIELDS (Newsgroups Content-MD5 >> Content-Disposition Content-Language Content-Location Followup-To References)] INTERNALDATE >> RFC822.SIZE FLAGS) While the second resulted in >> FETCH 1:last (UID INTERNALDATE RFC822.SIZE FLAGS) As a result, using SORTDATE took 3 seconds longer to complete on a 800-emails mailbox, while the results are quite the same (except if you have to deal with forged dates or timezones, but the arrival order is far more logical) My advice if you sort your emails by arrival is to actually use SORTARRIVAL, or better don't use imap_sort and go straight with message numbers (not UIDs). On large mailboxes, if you display messages per page, you will have significant performance increases (by avoiding 5 seconds of sorting). ---- Server IP: 217.174.203.10 Probable Submitter: 82.237.177.72 ---- Manual Page -- http://www.php.net/manual/en/function.imap-sort.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+61688 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+61688&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+61688&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+61688&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+61688&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+61688&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+61688&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+61688&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+61688&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#103368) next »