<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Gets and sort messages</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.imap-setflag-full.html">imap_setflag_full</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.imap-status.html">imap_status</a></div> <div class="up"><a href="ref.imap.html">IMAP Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="function.imap-sort" class="refentry"> <div class="refnamediv"> <h1 class="refname">imap_sort</h1> <p class="verinfo">(PHP 4, PHP 5)</p><p class="refpurpose"><span class="refname">imap_sort</span> — <span class="dc-title">Gets and sort messages</span></p> </div> <div class="refsect1 description" id="refsect1-function.imap-sort-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type">array</span> <span class="methodname"><strong>imap_sort</strong></span> ( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$imap_stream</code></span> , <span class="methodparam"><span class="type">int</span> <code class="parameter">$criteria</code></span> , <span class="methodparam"><span class="type">int</span> <code class="parameter">$reverse</code></span> [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$options</code><span class="initializer"> = 0</span></span> [, <span class="methodparam"><span class="type">string</span> <code class="parameter">$search_criteria</code><span class="initializer"> = <strong><code>NULL</code></strong></span></span> [, <span class="methodparam"><span class="type">string</span> <code class="parameter">$charset</code><span class="initializer"> = NIL</span></span> ]]] )</div> <p class="para rdfs-comment"> Gets and sorts message numbers by the given parameters. </p> </div> <div class="refsect1 parameters" id="refsect1-function.imap-sort-parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <span class="term"><em><code class="parameter"> imap_stream</code></em></span><dd> <p class="para">An IMAP stream returned by <span class="function"><a href="function.imap-open.html" class="function">imap_open()</a></span>.</p></dd> </dt> <dt> <span class="term"><em><code class="parameter">criteria</code></em></span> <dd> <p class="para"> Criteria can be one (and only one) of the following: <ul class="itemizedlist"> <li class="listitem"> <span class="simpara"> <strong><code>SORTDATE</code></strong> - message Date </span> </li> <li class="listitem"> <span class="simpara"> <strong><code>SORTARRIVAL</code></strong> - arrival date </span> </li> <li class="listitem"> <span class="simpara"> <strong><code>SORTFROM</code></strong> - mailbox in first From address </span> </li> <li class="listitem"> <span class="simpara"> <strong><code>SORTSUBJECT</code></strong> - message subject </span> </li> <li class="listitem"> <span class="simpara"> <strong><code>SORTTO</code></strong> - mailbox in first To address </span> </li> <li class="listitem"> <span class="simpara"> <strong><code>SORTCC</code></strong> - mailbox in first cc address </span> </li> <li class="listitem"> <span class="simpara"> <strong><code>SORTSIZE</code></strong> - size of message in octets </span> </li> </ul> </p> </dd> </dt> <dt> <span class="term"><em><code class="parameter">reverse</code></em></span> <dd> <p class="para"> Set this to 1 for reverse sorting </p> </dd> </dt> <dt> <span class="term"><em><code class="parameter">options</code></em></span> <dd> <p class="para"> The <em><code class="parameter">options</code></em> are a bitmask of one or more of the following: <ul class="itemizedlist"> <li class="listitem"> <span class="simpara"> <strong><code>SE_UID</code></strong> - Return UIDs instead of sequence numbers </span> </li> <li class="listitem"> <span class="simpara"> <strong><code>SE_NOPREFETCH</code></strong> - Don't prefetch searched messages </span> </li> </ul> </p> </dd> </dt> <dt> <span class="term"><em><code class="parameter">search_criteria</code></em></span> <dd> <p class="para"> </p> </dd> </dt> <dt> <span class="term"><em><code class="parameter">charset</code></em></span> <dd> <p class="para"> </p> </dd> </dt> </dl> </p> </div> <div class="refsect1 returnvalues" id="refsect1-function.imap-sort-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> Returns an array of message numbers sorted by the given parameters. </p> </div> <div class="refsect1 changelog" id="refsect1-function.imap-sort-changelog"> <h3 class="title">Changelog</h3> <p class="para"> <table class="doctable informaltable"> <thead> <tr> <th>Version</th> <th>Description</th> </tr> </thead> <tbody class="tbody"> <tr> <td>4.3.3</td> <td> The <em><code class="parameter">charset</code></em> parameter was added </td> </tr> </tbody> </table> </p> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.imap-setflag-full.html">imap_setflag_full</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.imap-status.html">imap_status</a></div> <div class="up"><a href="ref.imap.html">IMAP Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>