title: Get particular imap folder names PHP
body: <p>I need to get the imap folder names , and normally i do</p>
  
  <pre><code>&lt;?php
  $mbox = imap_open(SERVER,USERNAME,PASSWORD)
        or die("can't connect: " . imap_last_error());
  
  $list = imap_getmailboxes($mbox, SERVER, "*");
  if (is_array($list)) {
      foreach ($list as $key =&gt; $val) {
          echo "($key) ";
          echo imap_utf7_decode($val-&gt;name) . ",";
          echo "'" . $val-&gt;delimiter . "',";
          echo $val-&gt;attributes . "&lt;br /&gt;\n";
      }
  } else {
      echo "imap_getmailboxes failed: " . imap_last_error() . "\n";
  }
  
  imap_close($mbox);
  ?&gt;
  </code></pre>
  
  <p>It will give us an array of mailbox names , but what i need to get is particular mailbox names.</p>
  
  <p>Ex : for email sent items some servers gives me <code>Sent Items</code> and some others <code>Sent</code>. So it depending on the server.</p>
  
  <p>My requirement is i need to search for <code>Inbox</code> and <code>Sent Items</code>.</p>
  
  <p>What is the most preferable way to achieve this ?</p>