(PHP 4, PHP 5, PHP 7, PHP 8)
imap_sort — Gets and sort messages
$imap,$criteria,$reverse,$flags = 0,$search_criteria = null,$charset = nullGets and sorts message numbers by the given parameters.
imapAn IMAP\Connection instance.
criteriaCriteria can be one (and only one) of the following:
SORTDATE - message DateSORTARRIVAL - arrival dateSORTFROM - mailbox in first From addressSORTSUBJECT - message subjectSORTTO - mailbox in first To addressSORTCC - mailbox in first cc addressSORTSIZE - size of message in octetsreverseWhether to sort in reverse order.
flagsThe flags are a bitmask of one or more of the following:
SE_UID - Return UIDs instead of sequence numbersSE_NOPREFETCH - Don't prefetch searched messagessearch_criteriaIMAP2-format search criteria string. For details see imap_search().
charsetMIME character set to use when sorting strings.
Returns an array of message numbers sorted by the given parameters, or false on failure.
| Version | Description |
|---|---|
| 8.1.0 | The imap parameter expects an IMAP\Connection instance now; previously, a valid imap resource was expected. |
| 8.0.0 | reverse is now bool instead of int. |
| 8.0.0 | search_criteria and charset are now nullable. |